From e7281ecba6aa118252e4846952691b5d9c7cbfd2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Tue, 14 Jun 2005 23:40:43 +0000 Subject: [PATCH] Fixed a bug in next_argument(): it could read after the terminating null byte, and add junk as arguments. Thanks to Korli for testing. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13134 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/system/libroot/os/image.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/system/libroot/os/image.c b/src/system/libroot/os/image.c index 13ad1b6168..cc101efa4a 100644 --- a/src/system/libroot/os/image.c +++ b/src/system/libroot/os/image.c @@ -130,7 +130,11 @@ next_argument(char **_start, bool separate) if (line[i] == '\\' && line[i + 1] != '\0') continue; - if ((!quote && line[i] == ' ') || line[i] == quote || line[i] == '\0') { + if (line[i] == '\0') { + *_start = &line[i]; + return line; + } + if ((!quote && line[i] == ' ') || line[i] == quote) { // argument separator! if (separate) line[i] = '\0';