aboutsummaryrefslogtreecommitdiff
path: root/toys/posix/patch.c
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2014-10-09 12:17:36 -0500
committerRob Landley <rob@landley.net>2014-10-09 12:17:36 -0500
commit7196d758a0728bd43451f869eb85528b6cd20bea (patch)
treee1e35e3ac05c1550564671ef9a20fae61b0c71ed /toys/posix/patch.c
parent3087b50f123e310b55b74db765a87e121cbb11af (diff)
downloadtoybox-7196d758a0728bd43451f869eb85528b6cd20bea.tar.gz
Fix use-after-free spotted by Ashwini Sharma's static analysis.
We xstrdup() an optargs string to avoid modifying our environment space (because it can change what "ps" shows to other processes), and then parse out colon delimited strings and save them in globals that can later be used in the -v codepath and so on. But those globals _aren't_ strdup (no point) which means we can't free the string while we're still using pointers into the middle of it. So move the free to the end. (I hardly ever test with CFG_TOYBOX_FREE switched on because even nommu doesn't need it.)
Diffstat (limited to 'toys/posix/patch.c')
0 files changed, 0 insertions, 0 deletions