chiark / gitweb /
[PATCH] klibc: strlcpy/strlcat - don't alter destination if size == 0
[elogind.git] / udev_libc_wrapper.c
index 23cb7b4..d69f2ac 100644 (file)
@@ -58,7 +58,8 @@ size_t strlcpy(char *dst, const char *src, size_t size)
                bytes++;
        }
 
-       *q = '\0';
+       if (size)
+               *q = '\0';
        return bytes;
 }
 
@@ -82,7 +83,8 @@ size_t strlcat(char *dst, const char *src, size_t size)
                bytes++;
        }
 
-       *q = '\0';
+       if (size)
+               *q = '\0';
        return bytes;
 }
 #endif /* __OWN_STRLCPYCAT__ */