summaryrefslogtreecommitdiff
path: root/gnu/usr.bin/patch
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/usr.bin/patch')
-rw-r--r--gnu/usr.bin/patch/common.h1
-rw-r--r--gnu/usr.bin/patch/pch.c3
2 files changed, 3 insertions, 1 deletions
diff --git a/gnu/usr.bin/patch/common.h b/gnu/usr.bin/patch/common.h
index 7063be682429..aa191054aa17 100644
--- a/gnu/usr.bin/patch/common.h
+++ b/gnu/usr.bin/patch/common.h
@@ -34,6 +34,7 @@
#define Strcpy (void)strcpy
#define Strcat (void)strcat
#define Strlcpy (void)strlcpy
+#define Strncpy (void)strncpy
#define Strlcat (void)strlcat
/* NeXT declares malloc and realloc incompatibly from us in some of
diff --git a/gnu/usr.bin/patch/pch.c b/gnu/usr.bin/patch/pch.c
index 1638241151a6..e4fd8eec6cd4 100644
--- a/gnu/usr.bin/patch/pch.c
+++ b/gnu/usr.bin/patch/pch.c
@@ -1152,7 +1152,8 @@ pgets(bool do_indent)
indent++;
}
}
- Strlcpy(buf, line, len + 1 - skipped);
+ Strncpy(buf, line, len - skipped);
+ buf[len - skipped] = '\0';
}
return len;
}