summaryrefslogtreecommitdiffstats
path: root/gnu
diff options
context:
space:
mode:
Diffstat (limited to 'gnu')
-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 7063be6..aa19105 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 d72f84f..dba4582 100644
--- a/gnu/usr.bin/patch/pch.c
+++ b/gnu/usr.bin/patch/pch.c
@@ -1176,7 +1176,8 @@ pgets(bool do_indent)
indent++;
}
}
- Strlcpy(buf, line, len + 1 - skipped);
+ Strncpy(buf, line, len - skipped);
+ buf[len - skipped] = '\0';
}
return len;
}
OpenPOWER on IntegriCloud