summaryrefslogtreecommitdiff
path: root/klibc
diff options
context:
space:
mode:
authorkay.sievers@vrfy.org <kay.sievers@vrfy.org>2005-03-28 00:18:49 +0200
committerGreg KH <gregkh@suse.de>2005-04-26 23:55:00 -0700
commit4f8d44c220d811352b63c65b5a66403339005aac (patch)
treebda99735452286ba436e65d53b7392e83096ef64 /klibc
parent8a4c0c32f4252efb0f0adbf5cdc0261d359cd568 (diff)
[PATCH] klibc: strlcpy/strlcat - don't alter destination if size == 0
Diffstat (limited to 'klibc')
-rw-r--r--klibc/klibc/strlcat.c3
-rw-r--r--klibc/klibc/strlcpy.c3
2 files changed, 4 insertions, 2 deletions
diff --git a/klibc/klibc/strlcat.c b/klibc/klibc/strlcat.c
index f397857e76..fdd72ac392 100644
--- a/klibc/klibc/strlcat.c
+++ b/klibc/klibc/strlcat.c
@@ -26,7 +26,8 @@ size_t strlcat(char *dst, const char *src, size_t size)
bytes++;
}
- *q = '\0';
+ if (size)
+ *q = '\0';
return bytes;
}
diff --git a/klibc/klibc/strlcpy.c b/klibc/klibc/strlcpy.c
index 8b36c43c00..9e7b6bf91f 100644
--- a/klibc/klibc/strlcpy.c
+++ b/klibc/klibc/strlcpy.c
@@ -19,7 +19,8 @@ size_t strlcpy(char *dst, const char *src, size_t size)
bytes++;
}
- *q = '\0';
+ if (size)
+ *q = '\0';
return bytes;
}