Issue #491: bus error in resolve_origin()
resolve_origin attempts to insert '\0' into a field from a DL_info struct, causes BUS error. Signed-off-by: Nicolas Williams <nico@cryptonector.com>
This commit is contained in:

committed by
Nicolas Williams

parent
38a92f759d
commit
f604e424d1
@@ -245,12 +245,16 @@ resolve_origin(const char *di)
|
|||||||
p = strrchr(dname, '\\');
|
p = strrchr(dname, '\\');
|
||||||
if (p == NULL)
|
if (p == NULL)
|
||||||
#endif
|
#endif
|
||||||
p = strrchr(dname, '/');
|
|
||||||
if (p)
|
|
||||||
*p = '\0';
|
|
||||||
|
|
||||||
|
p = strrchr(dname, '/');
|
||||||
|
if (p) {
|
||||||
|
if (asprintf(&path, "%.*s%s", (int) (p - dname), dname, di) == -1)
|
||||||
|
return NULL;
|
||||||
|
} else {
|
||||||
if (asprintf(&path, "%s%s", dname, di) == -1)
|
if (asprintf(&path, "%s%s", dname, di) == -1)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
return path;
|
return path;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user