diff options
author | Tim Kientzle <kientzle@FreeBSD.org> | 2004-07-25 04:15:50 +0000 |
---|---|---|
committer | Tim Kientzle <kientzle@FreeBSD.org> | 2004-07-25 04:15:50 +0000 |
commit | 4f23b47afa667972f8809ddd21fe1fb09e14001b (patch) | |
tree | 84cfc1bbe14c0ef5f72491304366c2674dc278d9 /usr.bin/tar/util.c | |
parent | 6c1c7ea2e46ec842bc6e8528417aff41beed5723 (diff) | |
download | src-4f23b47afa667972f8809ddd21fe1fb09e14001b.tar.gz src-4f23b47afa667972f8809ddd21fe1fb09e14001b.zip |
A bunch of style and security fixes (error checking return values, etc),
mostly from: Tim J Robbins
Notes
Notes:
svn path=/head/; revision=132623
Diffstat (limited to 'usr.bin/tar/util.c')
-rw-r--r-- | usr.bin/tar/util.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/usr.bin/tar/util.c b/usr.bin/tar/util.c index d0ea39e6b386..48e30c239304 100644 --- a/usr.bin/tar/util.c +++ b/usr.bin/tar/util.c @@ -169,10 +169,12 @@ yes(const char *fmt, ...) fflush(stderr); l = read(2, buff, sizeof(buff)); + if (l <= 0) + return (0); buff[l] = 0; for (p = buff; *p != '\0'; p++) { - if (isspace(*p)) + if (isspace(0xff & (int)*p)) continue; switch(*p) { case 'y': case 'Y': @@ -301,7 +303,7 @@ process_lines(struct bsdtar *bsdtar, const char *pathname, } else { /* Line is too big; enlarge the buffer. */ p = realloc(buff, buff_length *= 2); - if (buff == NULL) + if (p == NULL) bsdtar_errc(bsdtar, 1, ENOMEM, "Line too long in %s", pathname); buff_end = p + (buff_end - buff); |