mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-10 16:20:42 +00:00
Fix check for string terminator and improve formatting
This commit is contained in:
parent
e2f6d591b3
commit
2382fed763
1 changed files with 21 additions and 14 deletions
|
@ -190,22 +190,29 @@ parseQuotedString(const char *keypath, size_t *i)
|
||||||
|
|
||||||
// Select the part of the quoted string that looks like a plist string
|
// Select the part of the quoted string that looks like a plist string
|
||||||
for (end = begin + 1; *end && *end != '"'; end++)
|
for (end = begin + 1; *end && *end != '"'; end++)
|
||||||
if (*end == '\\')
|
{
|
||||||
{
|
if (*end == '\\')
|
||||||
if (end[1])
|
{
|
||||||
end += 1;
|
if (end[1])
|
||||||
else
|
{
|
||||||
[NSException raise: NSInvalidArgumentException
|
end += 1;
|
||||||
format: @"Premature EOF in keypath"];
|
}
|
||||||
}
|
else
|
||||||
|
{
|
||||||
if (!end)
|
[NSException raise: NSInvalidArgumentException
|
||||||
[NSException raise: NSInvalidArgumentException
|
format: @"Premature EOF in keypath"];
|
||||||
format: @"Premature EOF in keypath"];
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!*end)
|
||||||
|
{
|
||||||
|
[NSException raise: NSInvalidArgumentException
|
||||||
|
format: @"Premature EOF in keypath"];
|
||||||
|
}
|
||||||
*i = end - keypath + 1;
|
*i = end - keypath + 1;
|
||||||
parsed = [[NSString stringWithCString: begin length: end - begin] propertyList];
|
parsed = [[NSString stringWithCString: begin length: end-begin] propertyList];
|
||||||
return (NSString *) parsed;
|
return (NSString *)parsed;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue