chiark / gitweb /
[PATCH] klibc: version 1.0.5
[elogind.git] / klibc / klibc / strlcpy.c
index 8b36c43c00cc10e31810fd0a864b25131b370c99..e6937445cd64e5a0a8da91e8cbfeb3924604ad8a 100644 (file)
@@ -19,7 +19,10 @@ size_t strlcpy(char *dst, const char *src, size_t size)
     bytes++;
   }
 
-  *q = '\0';
+  /* If size == 0 there is no space for a final null... */
+  if ( size )
+    *q = '\0';
+
   return bytes;
 }