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
This commit is contained in:
Axel Dörfler
2005-06-14 23:40:43 +00:00
parent 6a27b3b363
commit e7281ecba6
+5 -1
View File
@@ -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';