view configure @ 1517:7dacf2eda737 draft

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.)
author Rob Landley <rob@landley.net>
date Thu, 09 Oct 2014 12:17:36 -0500
parents 5f9fbf75ad34
children 2d5e3e345c14
line wrap: on
line source

# Toybox configuration file.

# This sets environment variables used by scripts/make.sh

# A synonym.
[ -z "$CROSS_COMPILE" ] && CROSS_COMPILE="$CROSS"
[ -z "$CFLAGS" ] && CFLAGS="-Wall -Wundef -Wno-char-subscripts"
# Required for our expected ABI. we're 8-bit clean thus "char" must be unsigned.
CFLAGS="$CFLAGS -funsigned-char"

[ -z "$OPTIMIZE" ] && OPTIMIZE="-Os -ffunction-sections -fdata-sections -fno-asynchronous-unwind-tables"
[ -z "$LDOPTIMIZE" ] && LDOPTIMIZE="-Wl,--gc-sections"
[ -z "$CC" ] && CC=cc
[ -z "$STRIP" ] && STRIP=strip

# If HOSTCC needs CFLAGS, add them to the variable ala HOSTCC="blah-cc --static"
[ -z "$HOSTCC" ] && HOSTCC=gcc