Fix bug dereferencing null pointer under some conditions.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@22515 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 2006-02-18 20:53:01 +00:00
parent d8e5e30dd0
commit 96bb9c77af
2 changed files with 11 additions and 4 deletions

View file

@ -1,3 +1,8 @@
2006-02-18 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSFileManager.m: Fix bug dereferencing nul pointer under
some conditions.
2006-02-17 Richard Frith-Macdonald <rfm@gnu.org> 2006-02-17 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSFileManager.m: Implement method to get name of files * Source/NSFileManager.m: Implement method to get name of files

View file

@ -231,8 +231,8 @@
*/ */
@interface GSAttrDictionary : NSDictionary @interface GSAttrDictionary : NSDictionary
{ {
_CHAR *_path;
struct _STATB statbuf; struct _STATB statbuf;
_CHAR _path[0];
} }
+ (NSDictionary*) attributesAt: (const _CHAR*)lpath + (NSDictionary*) attributesAt: (const _CHAR*)lpath
traverseLink: (BOOL)traverse; traverseLink: (BOOL)traverse;
@ -2746,10 +2746,12 @@ static NSSet *fileKeys = nil;
{ {
DESTROY(d); DESTROY(d);
} }
d->_path = (_CHAR*)&d[1]; if (d != nil)
for (i = 0; i <= l; i++)
{ {
d->_path[i] = lpath[i]; for (i = 0; i <= l; i++)
{
d->_path[i] = lpath[i];
}
} }
return AUTORELEASE(d); return AUTORELEASE(d);
} }