diff options
author | Pedro F. Giffuni <pfg@FreeBSD.org> | 2017-01-02 17:12:14 +0000 |
---|---|---|
committer | Pedro F. Giffuni <pfg@FreeBSD.org> | 2017-01-02 17:12:14 +0000 |
commit | ad8469feec8a84469d38b4a1237fd39abea16198 (patch) | |
tree | e1112d2d30e11fef4c8b9ee5947f3312df5d6717 /usr.bin/patch/patch.c | |
parent | 53d2e5b73e929fa982911eadae6e8514a2c946be (diff) |
Notes
Diffstat (limited to 'usr.bin/patch/patch.c')
-rw-r--r-- | usr.bin/patch/patch.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/usr.bin/patch/patch.c b/usr.bin/patch/patch.c index 1bdbcfb5b84b..71c1e45538b2 100644 --- a/usr.bin/patch/patch.c +++ b/usr.bin/patch/patch.c @@ -749,15 +749,13 @@ rej_line(int ch, LINENUM i) size_t len; const char *line = pfetch(i); - len = strnlen(line, USHRT_MAX); + len = strnlen(line, UINT_MAX); fprintf(rejfp, "%c%s", ch, line); - if (len == 0 || line[len-1] != '\n') { - if (len >= USHRT_MAX) - fprintf(rejfp, "\n\\ Line too long\n"); - else - fprintf(rejfp, "\n\\ No newline at end of line\n"); - } + if (len == 0 || line[len-1] != '\n') + fprintf(rejfp, "\n\\ No newline at end of line\n"); + else if (len >= UINT_MAX) + fprintf(rejfp, "\n\\ Line too long\n"); } static void @@ -1024,7 +1022,7 @@ patch_match(LINENUM base, LINENUM offset, LINENUM fuzz) LINENUM pat_lines = pch_ptrn_lines() - fuzz; const char *ilineptr; const char *plineptr; - unsigned short plinelen; + u_int plinelen; for (iline = base + offset + fuzz; pline <= pat_lines; pline++, iline++) { ilineptr = ifetch(iline, offset >= 0); |