[grilo-plugins] dleyna: Handle broken /proc/net/tcp file
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [grilo-plugins] dleyna: Handle broken /proc/net/tcp file
- Date: Thu, 27 Nov 2014 16:04:46 +0000 (UTC)
commit 465c58cc432e59c5f29be670d1ad80d4f05f0522
Author: Bastien Nocera <hadess hadess net>
Date: Thu Nov 27 15:59:59 2014 +0100
dleyna: Handle broken /proc/net/tcp file
Don't crash if we reach the end of the line when skipping the first
field of /proc/net/tcp
https://bugzilla.gnome.org/show_bug.cgi?id=740052
src/dleyna/grl-dleyna-utils.c | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/src/dleyna/grl-dleyna-utils.c b/src/dleyna/grl-dleyna-utils.c
index 51b88e5..cbfbe21 100644
--- a/src/dleyna/grl-dleyna-utils.c
+++ b/src/dleyna/grl-dleyna-utils.c
@@ -136,8 +136,10 @@ is_our_user_ipv4 (struct sockaddr_in *address)
j++;
/* skip the first field */
- while (line[j] != ' ')
+ while (line[j] != ' ' && line[j] != '\0')
j++;
+ if (line[j] == '\0' )
+ continue;
while (line[j] == ' ')
j++;
@@ -227,8 +229,10 @@ is_our_user_ipv6 (struct sockaddr_in6 *address)
j++;
/* skip the first field */
- while (line[j] != ' ')
+ while (line[j] != ' ' && line[j] != '\0')
j++;
+ if (line[j] == '\0' )
+ continue;
while (line[j] == ' ')
j++;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]