diff options
author | 2003-07-21 21:01:45 +0000 | |
---|---|---|
committer | 2003-07-21 21:01:45 +0000 | |
commit | f2ab214feb48329fd38125a1a1b4d58271235540 (patch) | |
tree | 20f4a0a7ae045c37c8bdeff6fedf771ed59765bb /usr.bin/patch/patch.c | |
parent | knote/KNOTE from netbsd (diff) | |
download | wireguard-openbsd-f2ab214feb48329fd38125a1a1b4d58271235540.tar.xz wireguard-openbsd-f2ab214feb48329fd38125a1a1b4d58271235540.zip |
Back out invalid line number fix. It core dumps in some cases. Problem found by
marc@.
ok henning@
Diffstat (limited to 'usr.bin/patch/patch.c')
-rw-r--r-- | usr.bin/patch/patch.c | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/usr.bin/patch/patch.c b/usr.bin/patch/patch.c index c09c0f86eab..d3a10bcb36c 100644 --- a/usr.bin/patch/patch.c +++ b/usr.bin/patch/patch.c @@ -1,4 +1,4 @@ -/* $OpenBSD: patch.c,v 1.21 2003/07/21 14:32:21 deraadt Exp $ */ +/* $OpenBSD: patch.c,v 1.22 2003/07/21 21:01:45 otto Exp $ */ /* * patch - a program to apply diffs to original files @@ -27,7 +27,7 @@ */ #ifndef lint -static char rcsid[] = "$OpenBSD: patch.c,v 1.21 2003/07/21 14:32:21 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: patch.c,v 1.22 2003/07/21 21:01:45 otto Exp $"; #endif /* not lint */ #include "INTERN.h" @@ -838,11 +838,8 @@ dump_line(LINENUM line) { char *s, R_newline = '\n'; - s = ifetch(line, 0); - if (s == NULL) - return; /* Note: string is not null terminated. */ - for (; putc(*s, ofp) != R_newline; s++) + for (s=ifetch(line, 0); putc(*s, ofp) != R_newline; s++) ; } @@ -874,8 +871,6 @@ patch_match(LINENUM base, LINENUM offset, LINENUM fuzz) bool similar(char *a, char *b, int len) { - if (a == NULL || b == NULL) - return FALSE; while (len) { if (isspace(*b)) { /* whitespace (or \n) to match? */ if (!isspace(*a)) /* no corresponding whitespace? */ |