From ae7139adcfa65991c71616e8de7910ff722d4166 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Tue, 5 Jul 2011 14:16:17 -0500 Subject: Remove most usages of strncmp() The supposed safety blanket of this function is better handled by explicit length checking and usages of strlen() on known NULL-terminated strings rather than hoping things fit in a buffer. We also have no need to fully fill a PATH_MAX length variable with NULLs every time as long as a single terminating byte is there. Remove usages of it by using strcpy() or memcpy() as appropriate, after doing length checks via strlen(). Signed-off-by: Dan McGee --- lib/libalpm/handle.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/libalpm/handle.c') diff --git a/lib/libalpm/handle.c b/lib/libalpm/handle.c index ddd76a25..9bffd4fd 100644 --- a/lib/libalpm/handle.c +++ b/lib/libalpm/handle.c @@ -299,7 +299,7 @@ static char *canonicalize_path(const char *path) { len += 1; } CALLOC(new_path, len + 1, sizeof(char), return NULL); - strncpy(new_path, path, len); + strcpy(new_path, path); new_path[len - 1] = '/'; return new_path; } -- cgit v1.2.3-24-g4f1b