mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-30 08:21:25 +00:00
fix possible nul pointer deref
This commit is contained in:
parent
3d98433cc7
commit
f7c71c695e
2 changed files with 12 additions and 7 deletions
|
@ -347,14 +347,18 @@ static char *buildURL(parsedURL *base, parsedURL *rel, BOOL standardize)
|
|||
else
|
||||
{
|
||||
char *start = base->path;
|
||||
char *end = strrchr(start, '/');
|
||||
|
||||
if (end != 0)
|
||||
{
|
||||
*tmp++ = '/';
|
||||
memcpy(tmp, start, end - start);
|
||||
tmp += (end - start);
|
||||
}
|
||||
if (start != 0)
|
||||
{
|
||||
char *end = strrchr(start, '/');
|
||||
|
||||
if (end != 0)
|
||||
{
|
||||
*tmp++ = '/';
|
||||
memcpy(tmp, start, end - start);
|
||||
tmp += (end - start);
|
||||
}
|
||||
}
|
||||
*tmp++ = '/';
|
||||
l = strlen(rpath);
|
||||
memcpy(tmp, rpath, l);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue