From e3a55094420e4101832fe11ab5e988de2547029d Mon Sep 17 00:00:00 2001 From: Juan RP Date: Sun, 21 Dec 2008 03:24:52 +0100 Subject: [PATCH] xbps-bin: handle a case where sanitize_localpath() failed. --HG-- extra : convert_revision : f762239729644494ea9305079d0386b807ecedfc --- utils/xbps-bin.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/utils/xbps-bin.c b/utils/xbps-bin.c index ea87a9a0a8..c78979a546 100644 --- a/utils/xbps-bin.c +++ b/utils/xbps-bin.c @@ -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);