From 91a8be5262a5e109e7bf67c2d7823878b7bedf02 Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Wed, 6 Jul 2011 12:31:37 +0200 Subject: [PATCH] Silenced a warning of cppcheck about possible null pointer dereference. --- libisofs/util.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libisofs/util.c b/libisofs/util.c index 42e5af3..f674cda 100644 --- a/libisofs/util.c +++ b/libisofs/util.c @@ -1574,12 +1574,12 @@ void strncpy_pad(char *dest, const char *src, size_t max) if (src != NULL) { len = MIN(strlen(src), max); + for (i = 0; i < len; ++i) + dest[i] = src[i]; } else { len = 0; } - for (i = 0; i < len; ++i) - dest[i] = src[i]; for (i = len; i < max; ++i) dest[i] = ' '; }