symlinks/symlinks-coverity-overrun-dynamic.patch
Tim Waugh e7fa1c3d91 Applied patches from Jiri Popelka:
Fix off-by-one error in call to readlink.
Fix possible buffer overrun found by coverity.
2011-05-20 15:33:52 +01:00

13 lines
491 B
Diff

diff -up symlinks-1.4/symlinks.c.coverity-overrun-dynamic symlinks-1.4/symlinks.c
--- symlinks-1.4/symlinks.c.coverity-overrun-dynamic 2011-05-20 14:10:25.682843723 +0100
+++ symlinks-1.4/symlinks.c 2011-05-20 14:11:15.792920839 +0100
@@ -44,7 +44,7 @@ static int substr (char *s, char *old, c
newlen = strlen(new);
if (newlen > oldlen) {
- if ((tmp = malloc(strlen(s))) == NULL) {
+ if ((tmp = malloc(strlen(s)+1)) == NULL) {
fprintf(stderr, "no memory\n");
exit (1);
}