diff options
| author | Kyle Evans <kevans@FreeBSD.org> | 2017-10-09 14:50:02 +0000 |
|---|---|---|
| committer | Kyle Evans <kevans@FreeBSD.org> | 2017-10-09 14:50:02 +0000 |
| commit | 4835edfa0d452a9d75eeb73c3414d563ec9909f9 (patch) | |
| tree | ce5f4af4a9acdf8c3d7df040bbd25c56f06d55ec /usr.bin/patch/pch.c | |
| parent | 4363782bc3d5d08d3e192a320b3e581315404dc6 (diff) | |
Notes
Diffstat (limited to 'usr.bin/patch/pch.c')
| -rw-r--r-- | usr.bin/patch/pch.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/usr.bin/patch/pch.c b/usr.bin/patch/pch.c index 563c539b56863..d9087bb323914 100644 --- a/usr.bin/patch/pch.c +++ b/usr.bin/patch/pch.c @@ -1135,7 +1135,12 @@ hunk_done: if (*buf != '>') fatal("> expected at line %ld of patch\n", p_input_line); - p_line[i] = savestr(buf + 2); + /* Don't overrun if we don't have enough line */ + if (len > 2) + p_line[i] = savestr(buf + 2); + else + p_line[i] = savestr(""); + if (out_of_mem) { p_end = i - 1; return false; |
