diff options
author | ache <ache@FreeBSD.org> | 2002-03-25 14:22:31 +0000 |
---|---|---|
committer | ache <ache@FreeBSD.org> | 2002-03-25 14:22:31 +0000 |
commit | 9354df3c222b65ec9304a20f43f642b9c30cd146 (patch) | |
tree | abab89f37e288e892919c2d624b5893dda85b56d /usr.bin | |
parent | a80a96a3d8dd8570c2486c9865d3c9d5caa79597 (diff) | |
download | FreeBSD-src-9354df3c222b65ec9304a20f43f642b9c30cd146.zip FreeBSD-src-9354df3c222b65ec9304a20f43f642b9c30cd146.tar.gz |
Remove double REC_D assignment
Cast REC_D optarg assignment to (u_char) to prevent out of bounds indexing
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/sort/sort.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/usr.bin/sort/sort.c b/usr.bin/sort/sort.c index 4c10233..440363b 100644 --- a/usr.bin/sort/sort.c +++ b/usr.bin/sort/sort.c @@ -116,7 +116,7 @@ main(argc, argv) memset(fldtab, 0, (ND+2)*sizeof(struct field)); memset(d_mask, 0, NBINS); - d_mask[REC_D = '\n'] = REC_D_F; + d_mask[REC_D] = REC_D_F; SINGL_FLD = SEP_FLAG = 0; d_mask['\t'] = d_mask[' '] = BLANK | FLD_D; ftpos = fldtab; @@ -176,7 +176,7 @@ main(argc, argv) case 'R': if (REC_D != '\n') usage("multiple record delimiters"); - if ('\n' == (REC_D = *optarg)) + if ('\n' == (REC_D = (u_char)*optarg)) break; d_mask['\n'] = d_mask[' ']; d_mask[REC_D] = REC_D_F; |