mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-25 01:31:08 +00:00
Make sure we don't crash while trying to parse a command line argument
as being a property list git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@10782 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
86122e9e29
commit
6f49358214
1 changed files with 26 additions and 3 deletions
|
@ -1155,11 +1155,34 @@ static NSString *pathForUser(NSString *user)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ // Real parameter
|
{ // Real parameter
|
||||||
val = [val propertyList];
|
/* Parsing the argument as a property list is very
|
||||||
[argDict setObject: val forKey: key];
|
delicate. We *MUST NOT* crash here just because a
|
||||||
|
strange parameter (such as `(load "test.scm")`) is
|
||||||
|
passed, otherwise the whole library is useless in a
|
||||||
|
foreign environment. */
|
||||||
|
NSObject *plist_val;
|
||||||
|
|
||||||
|
NS_DURING
|
||||||
|
{
|
||||||
|
plist_val = [val propertyList];
|
||||||
|
}
|
||||||
|
NS_HANDLER
|
||||||
|
{
|
||||||
|
plist_val = val;
|
||||||
|
}
|
||||||
|
NS_ENDHANDLER
|
||||||
|
|
||||||
|
/* Make sure we don't crash being caught adding nil to
|
||||||
|
a dictionary. */
|
||||||
|
if (plist_val == nil)
|
||||||
|
{
|
||||||
|
plist_val = val;
|
||||||
|
}
|
||||||
|
|
||||||
|
[argDict setObject: plist_val forKey: key];
|
||||||
if (old != nil)
|
if (old != nil)
|
||||||
{
|
{
|
||||||
[argDict setObject: val forKey: old];
|
[argDict setObject: plist_val forKey: old];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue