diff options
author | pfg <pfg@FreeBSD.org> | 2014-06-15 03:54:23 +0000 |
---|---|---|
committer | pfg <pfg@FreeBSD.org> | 2014-06-15 03:54:23 +0000 |
commit | 8be207723a26264124536760d079a00cc56b1077 (patch) | |
tree | d8f74b1b7360c8d7022216091822882c6d2599d8 /usr.bin/patch/pch.h | |
parent | b90626f6970f1bb69db6021e3b652fdba3e6be13 (diff) | |
download | FreeBSD-src-8be207723a26264124536760d079a00cc56b1077.zip FreeBSD-src-8be207723a26264124536760d079a00cc56b1077.tar.gz |
patch: unsign the line length to avoid overflows.
Patch(1) uses a short int for the line length, which is usually
sufficient for regular diffs, but makes no effort to signal
when there is an overflow.
Change the line length to an unsigned short int to better use
the fact that a length is never negative. The change is loosely
inspired on a related change in DragonFly, but we avoid spending
more memory than necessary.
While here adjust the messages to be clearer on what is happening.
MFC after: 1 week
Diffstat (limited to 'usr.bin/patch/pch.h')
-rw-r--r-- | usr.bin/patch/pch.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/usr.bin/patch/pch.h b/usr.bin/patch/pch.h index e60cc86..da7a08d 100644 --- a/usr.bin/patch/pch.h +++ b/usr.bin/patch/pch.h @@ -44,7 +44,7 @@ bool there_is_another_patch(void); bool another_hunk(void); bool pch_swap(void); char *pfetch(LINENUM); -short pch_line_len(LINENUM); +unsigned short pch_line_len(LINENUM); LINENUM pch_first(void); LINENUM pch_ptrn_lines(void); LINENUM pch_newfirst(void); |