lib/initend.c: CID 62720 (NULL pointer dereference)

This commit is contained in:
Juan RP 2014-10-07 07:59:07 +02:00
parent 4be2a0ee84
commit a730a61df9

View File

@ -120,7 +120,7 @@ store_preserved_file(struct xbps_handle *xhp, const char *file)
len = strlen(globbuf.gl_pathv[i]) - strlen(xhp->rootdir) + 1; len = strlen(globbuf.gl_pathv[i]) - strlen(xhp->rootdir) + 1;
p = malloc(len); p = malloc(len);
assert(len); assert(p);
strlcpy(p, globbuf.gl_pathv[i] + strlen(xhp->rootdir), len); strlcpy(p, globbuf.gl_pathv[i] + strlen(xhp->rootdir), len);
xbps_array_add_cstring(xhp->preserved_files, p); xbps_array_add_cstring(xhp->preserved_files, p);
xbps_dbg_printf(xhp, "Added preserved file: %s (expanded from %s)\n", p, file); xbps_dbg_printf(xhp, "Added preserved file: %s (expanded from %s)\n", p, file);