summaryrefslogtreecommitdiff
path: root/usr.bin/patch/pch.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin/patch/pch.c')
-rw-r--r--usr.bin/patch/pch.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/usr.bin/patch/pch.c b/usr.bin/patch/pch.c
index ece445ed578..abed3936332 100644
--- a/usr.bin/patch/pch.c
+++ b/usr.bin/patch/pch.c
@@ -1,7 +1,7 @@
-/* $OpenBSD: pch.c,v 1.6 1996/09/23 10:54:22 deraadt Exp $ */
+/* $OpenBSD: pch.c,v 1.7 1996/09/24 04:19:29 millert Exp $ */
#ifndef lint
-static char rcsid[] = "$OpenBSD: pch.c,v 1.6 1996/09/23 10:54:22 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: pch.c,v 1.7 1996/09/24 04:19:29 millert Exp $";
#endif /* not lint */
#include "EXTERN.h"
@@ -781,14 +781,16 @@ another_hunk()
fillsrc = 1;
filldst = fillsrc + p_ptrn_lines;
p_end = filldst + p_repl_lines;
- Sprintf(buf,"*** %ld,%ld ****\n",p_first,p_first + p_ptrn_lines - 1);
+ Snprintf(buf, sizeof buf, "*** %ld,%ld ****\n", p_first,
+ p_first + p_ptrn_lines - 1);
p_line[0] = savestr(buf);
if (out_of_mem) {
p_end = -1;
return FALSE;
}
p_char[0] = '*';
- Sprintf(buf,"--- %ld,%ld ----\n",p_newfirst,p_newfirst+p_repl_lines-1);
+ Snprintf(buf, sizeof buf, "--- %ld,%ld ----\n", p_newfirst,
+ p_newfirst + p_repl_lines - 1);
p_line[filldst] = savestr(buf);
if (out_of_mem) {
p_end = 0;
@@ -920,7 +922,8 @@ another_hunk()
grow_hunkmax();
p_newfirst = min;
p_repl_lines = max - min + 1;
- Sprintf(buf, "*** %ld,%ld\n", p_first, p_first + p_ptrn_lines - 1);
+ Snprintf(buf, sizeof buf, "*** %ld,%ld\n", p_first,
+ p_first + p_ptrn_lines - 1);
p_line[0] = savestr(buf);
if (out_of_mem) {
p_end = -1;
@@ -952,7 +955,7 @@ another_hunk()
if (*buf != '-')
fatal2("--- expected at line %ld of patch\n", p_input_line);
}
- Sprintf(buf, "--- %ld,%ld\n", min, max);
+ Snprintf(buf, sizeof(buf), "--- %ld,%ld\n", min, max);
p_line[i] = savestr(buf);
if (out_of_mem) {
p_end = i-1;
@@ -1227,9 +1230,9 @@ do_ed_script()
Unlink(TMPOUTNAME);
copy_file(filearg[0], TMPOUTNAME);
if (verbose)
- Sprintf(buf, "/bin/ed %s", TMPOUTNAME);
+ Snprintf(buf, sizeof buf, "/bin/ed %s", TMPOUTNAME);
else
- Sprintf(buf, "/bin/ed - %s", TMPOUTNAME);
+ Snprintf(buf, sizeof buf, "/bin/ed - %s", TMPOUTNAME);
pipefp = popen(buf, "w");
}
for (;;) {