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