summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephane E. Potvin <sepotvin@FreeBSD.org>2009-09-16 19:53:29 +0000
committerStephane E. Potvin <sepotvin@FreeBSD.org>2009-09-16 19:53:29 +0000
commit68961d1200a9cb6bf3619f292a56b2ea35a048ae (patch)
treeb87eac38031fbf477e18cfed856a37597d84a24a
parentd830c305ea38d44ac4fc84a5a53d26dc046dd1eb (diff)
Notes
-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 7063be682429c..aa191054aa173 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 d72f84f3069e1..dba4582e52a40 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;
}