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:
@@ -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';
|
||||
|
||||
Reference in New Issue
Block a user