From dc0ce488411a1866cfd5f185cf91e065ad7ffb01 Mon Sep 17 00:00:00 2001 From: Robert Love Date: Mon, 6 Feb 2006 17:12:04 +0000 Subject: [PATCH] 2006-02-06 Robert Love * src/NetworkManagerUtils.c: kill_newline(): 'l' is unsigned so the test ">=" is never false. If no newline is found, we loop forever. We can just check for ">" because the following if will see zero-th argument if the while gets that far. git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@1455 4912f4e0-d625-0410-9fb7-b9a5a253dbdc --- ChangeLog | 9 ++++++++- src/NetworkManagerUtils.c | 3 ++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 58728be26..b05905638 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2006-02-06 Robert Love + + * src/NetworkManagerUtils.c: kill_newline(): 'l' is unsigned so the + test ">=" is never false. If no newline is found, we loop forever. + We can just check for ">" because the following if will see zero-th + argument if the while gets that far. + 2006-02-05 Dan Williams Refine handling of non-broadcast networks. @@ -33,7 +40,7 @@ 2006-02-05 Robert Love - Patch by Christoph Brill + Patch by Christoph Brill : * src/dhcp-manager/nm-dhcp-manager.c: Replace two open coded defines with DHCP_SERVICE_NAME. diff --git a/src/NetworkManagerUtils.c b/src/NetworkManagerUtils.c index 841a031f4..55860dfd1 100644 --- a/src/NetworkManagerUtils.c +++ b/src/NetworkManagerUtils.c @@ -709,7 +709,8 @@ kill_newline (char *s, size_t *l) { g_return_val_if_fail (l != NULL, s); - while ((--(*l) >= 0) && (s[*l] != '\n')); + while ((--(*l) > 0) && (s[*l] != '\n')) + ; if (s[*l] == '\n') s[*l] = '\0'; return s;