]> err.no Git - systemd/commitdiff
[PATCH] klibc: strlcpy/strlcat - don't alter destination if size == 0
authorkay.sievers@vrfy.org <kay.sievers@vrfy.org>
Sun, 27 Mar 2005 22:18:49 +0000 (00:18 +0200)
committerGreg KH <gregkh@suse.de>
Wed, 27 Apr 2005 06:55:00 +0000 (23:55 -0700)
klibc/klibc/strlcat.c
klibc/klibc/strlcpy.c
udev_libc_wrapper.c

index f397857e76362f3badc9763f14aa06ba3779a677..fdd72ac392c5b910f19c5e66ecc6227f1577e41a 100644 (file)
@@ -26,7 +26,8 @@ size_t strlcat(char *dst, const char *src, size_t size)
     bytes++;
   }
 
-  *q = '\0';
+  if (size)
+    *q = '\0';
   return bytes;
 }
 
index 8b36c43c00cc10e31810fd0a864b25131b370c99..9e7b6bf91fa692779bcc7b7517bc4471c6695e49 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;
 }
 
index 23cb7b43168bc9ff7c3619bcf1440627f67f8b42..d69f2ac48e11dfb0dcc01daa6125089697307b93 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__ */