Remove double REC_D assignment

Cast REC_D optarg assignment to (u_char) to prevent out of bounds indexing
This commit is contained in:
Andrey A. Chernov 2002-03-25 14:22:31 +00:00
parent af154d5ce6
commit 3c1a6de57e

View File

@ -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;