aboutsummaryrefslogtreecommitdiffstats
path: root/src/set-fields.c
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2021-03-29 21:42:44 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2021-03-29 21:44:58 -0700
commite3766c5db176ca7abbb8212d5b0b7862fb98a5be (patch)
treedf17e7a75d6c05e19ba780e8f12e2e6d038aa28c /src/set-fields.c
parentbuild: update gnulib submodule to latest (diff)
downloadcoreutils-e3766c5db176ca7abbb8212d5b0b7862fb98a5be.tar.gz
coreutils-e3766c5db176ca7abbb8212d5b0b7862fb98a5be.zip
env: simplify --split-string memory management
* bootstrap.conf (gnulib_modules): Add idx. * src/env.c: Include idx.h, minmax.h. Prefer idx_t to ptrdiff_t when values are nonnegative. (valid_escape_sequence, escape_char, validate_split_str) (CHECK_START_NEW_ARG): Remove; no longer needed now that we validate as we go. (struct splitbuf): New type. (splitbuf_grow, splitbuf_append_byte, check_start_new_arg) (splitbuf_finishup): New functions. (build_argv): New arg ARGC. Validate and process in one go, using the new functions; this is simpler and more reliable than the old approach (as witness the recent bug). Avoid integer overflow in the unlikely case where the string contains more than INT_MAX arguments. (parse_split_string): Simplify by exploiting the new build_argv.
Diffstat (limited to 'src/set-fields.c')
0 files changed, 0 insertions, 0 deletions