chiark / gitweb /
[PATCH] klibc: strlcpy/strlcat - don't alter destination if size == 0
[elogind.git] / klibc / klibc / strlcpy.c
index 8b36c43..9e7b6bf 100644 (file)
@@ -19,7 +19,8 @@ size_t strlcpy(char *dst, const char *src, size_t size)
     bytes++;
   }
 
-  *q = '\0';
+  if (size)
+    *q = '\0';
   return bytes;
 }