xbps-bin: handle a case where sanitize_localpath() failed.

--HG--
extra : convert_revision : f762239729644494ea9305079d0386b807ecedfc
This commit is contained in:
Juan RP 2008-12-21 03:24:52 +01:00
parent 2b70f95033
commit e3a5509442

View file

@ -132,10 +132,10 @@ sanitize_localpath(const char *path)
if (strcmp(basenp, base) == 0)
goto fail2;
/* Sanitize path into a temporary path. */
strncpy(strtmp, dirnp, sizeof(strtmp) - 1);
strtmp[sizeof(strtmp) - 1] = '\0';
strncat(strtmp, "/", sizeof(strtmp) - strlen(strtmp) - 1);
if (strcmp(dirnp, "/"))
strncat(strtmp, "/", sizeof(strtmp) - strlen(strtmp) - 1);
strncat(strtmp, basenp, sizeof(strtmp) - strlen(strtmp) -1);
free(dir);