diff options
author | 2003-07-16 16:06:53 +0000 | |
---|---|---|
committer | 2003-07-16 16:06:53 +0000 | |
commit | 328a6cea628e291608421215d51fb70167656df1 (patch) | |
tree | f17fcb6601b444be5ad29e8bb0adca2ca17a9148 /usr.bin/patch/inp.c | |
parent | Add support for unbuffered SBus LANCE devices. jason@ and deraadt@ OK (diff) | |
download | wireguard-openbsd-328a6cea628e291608421215d51fb70167656df1.tar.xz wireguard-openbsd-328a6cea628e291608421215d51fb70167656df1.zip |
Do not produce garbage if the patch file contains invalid line numbers.
ok millert@ tedu@
Diffstat (limited to 'usr.bin/patch/inp.c')
-rw-r--r-- | usr.bin/patch/inp.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/usr.bin/patch/inp.c b/usr.bin/patch/inp.c index a60d48aa138..51f29033b0c 100644 --- a/usr.bin/patch/inp.c +++ b/usr.bin/patch/inp.c @@ -1,7 +1,7 @@ -/* $OpenBSD: inp.c,v 1.9 2002/07/04 04:22:48 deraadt Exp $ */ +/* $OpenBSD: inp.c,v 1.10 2003/07/16 16:06:53 otto Exp $ */ #ifndef lint -static char rcsid[] = "$OpenBSD: inp.c,v 1.9 2002/07/04 04:22:48 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: inp.c,v 1.10 2003/07/16 16:06:53 otto Exp $"; #endif /* not lint */ #include "EXTERN.h" @@ -320,8 +320,10 @@ ifetch(line,whichbuf) Reg1 LINENUM line; int whichbuf; /* ignored when file in memory */ { - if (line < 1 || line > input_lines) - return ""; + if (line < 1 || line > input_lines) { + say2("No such line %ld in input file, ignoring\n", line); + return NULL; + } if (using_plan_a) return i_ptr[line]; else { |