summaryrefslogtreecommitdiff
path: root/bin/ksh/var.c
AgeCommit message (Collapse)Author
2023-07-23avoid MAIL* environment variables to save a few bytes in install mediaKlemens Nanni
ksh(1) MAIL, MAILCHECK, MAILPATH mbox handling is useless in the installer. OK miod deraadt
2021-03-05Fix old ksh bug: wrong variable being looked up when value is provided.Vadim Zhukov
This results, e.g., in allowing the first item of a read-only array to be overwritten, as found by Jordan Geoghegan. okay tb@
2020-02-21Enforce that TMOUT is an integer literal to prevent command execution fromTheo Buehler
the environment at shell initialization time. During startup, ksh calls 'eval typeset -i TMOUT="${TMOUT:-0}"'. which allows command injection via arithmetic expansion, e.g., by setting TMOUT to 'x[`/bin/echo Hi >&2`]'. Problem noted by Andras Farkas and tj, inspired by a similar issue in AT&T's ksh. Tested in snaps for two weeks. "go for it" deraadt
2018-06-18Use shl_out->fd instead of STDOUT_FILENO in the call the setupterm().Todd C. Miller
Suggested by anton@
2018-06-18Add clear-screen emacs editing command, currently not bound to aTodd C. Miller
key by default. The shell will query the terminfo database to find the escape sequence to clear the screen. OK deraadt@
2018-04-13Count $SECONDS with CLOCK_MONOTONIC.cheloha
Keeps $SECONDS advancing uniformly and independent of wall clock jumps. ok jca@
2018-04-09Support 64 bit integers on 32 bit architectures.Tobias Stoeckmann
No binary change on amd64 and there should be no differences on any other 64 bit architecture either (because long = int64_t). ok cheloha, tb
2018-03-15Favor usage of __func__ in warning/error messages. Some of them referred to theanton
wrong function and fix the rest for consistency. Diff from Michael W. Bombardieri with some cosmetic cleanup applied. ok benno@ tb@
2018-01-16Introduce internal_warningf() and mark internal_errorf() as noreturnJeremie Courreges-Anglas
This helps tools like scan-build, and follows the example of warningf() and errorf(). ok anton@
2018-01-15Stop pretending we support building ksh without EDIT/HISTORY supportJeremie Courreges-Anglas
ok anton@
2018-01-06Bring back the sign compare changes, this time with a fix from otto@Todd C. Miller
that fixes the issues seen on hppa. OK deraadt@ otto@
2018-01-04Back out sign compare changes that appear to cause problems on hppa.Todd C. Miller
Requested by deraadt@
2018-01-01Add WARNINGS=yes to ksh and fix the resulting sign compare warnings.Todd C. Miller
OK tb@
2017-12-27Add -Wshadow to Makefile and fix the resulting warnings. Many ofTodd C. Miller
the warnings are due to the use of globals with generic names, specifically "options" and "path". I've renamed "options" to "sh_options" since it holds the shell options and "path" to "search_path". OK jca@ tb@
2017-08-30Implement HISTCONTROL ignoredups & ignorespace featuresJeremie Courreges-Anglas
ignoredups: don't save the current line if it is identical to the last history line. ignorespace: don't save the current line if it starts with a space ok anton@ millert@
2017-08-30No need for NULL checks before afree()Jeremie Courreges-Anglas
2016-09-08Add KSH_IGNORE_RDONLY flag and use it in var.c instead of the 0x4Todd C. Miller
magic number.
2016-09-08Allow "typeset -ir FOO" if FOO is not already marked read-only. OK tb@Todd C. Miller
2015-12-30rename global "e" to genv to avoid accidental shadowing and aliasing.Ted Unangst
ok millert nicm tb
2015-12-14Move system headers from sh.h to those files that actually need them.tb
ok mmcc@ a while ago
2015-10-19Move string.h include from sh.h to the files that use it.mmcc
ok nicm@
2015-10-19Move limits.h include from sh.h to the files that actually need it. Nommcc
binary change. ok nicm@
2015-10-19Apply style(9) to header includes.mmcc
ok nicm@
2015-09-22Make errorf() and bi_errorf() handle a NULL argument.Todd C. Miller
From Michael McConville; OK nicm@
2015-09-18Last of the (thing *)0 -> NULL, from Michael McConville. No binaryNicholas Marriott
change.
2015-09-17Remove unnecessary casts, from Michael McConville. No binary change.Nicholas Marriott
2015-09-15correct spelling of NULL from (char *)0. from Michael McConville.Ted Unangst
ok md5
2015-09-14Replace Tflag typedef with just int; ok teduNicholas Marriott
2015-09-14Apply the ancient art of tedu to ksh_limval.h. ok guentherNicholas Marriott
2015-09-10Kill another superfluous variable initialization; from Michael McConville.Jeremie Courreges-Anglas
2015-09-01remove casts and null checks before free. from Michael McConvilleTed Unangst
ok deraadt
2015-08-19Don't re-include headers pulled by "sh.h". (I actually don't like this .hTheo de Raadt
pulls in system .h pattern)
2015-04-17Use getint() instead of intval() for parsing the columns variable,Theo de Raadt
allowing the addition of more accurate bounds and garbage checks. ok millert
2014-12-12Range check the value of the base for typeset -i base x=y. Instead ofJonathan Gray
erroring for values outside of the range switch to base 10 to match the behaviour of ksh93. As we have a smaller digit alphabet than ksh93 the accepted range is smaller (2-36) than ksh93 (2-64). The other form of setting a base, typeset -i x=base#y already has a range check that errors (as ksh93 also does for that syntax). Fixes a crash found with the afl fuzzer.
2014-12-08Don't need special complex rand vs arc4random code. If theTheo de Raadt
standards-mandated "seed" method is used, simply call srand_deterministic() and the subsystem switches out of strong random mode into C89 crap mode. ok millert
2013-12-20Fix a crash in ksh when trying to access ${12345678901234567890}Vadim Zhukov
Input from deraadt@, millert@ and otto@. okay from millert@ plus a willing from deraadt@
2013-12-18Remove artificial limit on the max array index.Todd C. Miller
Adapted from a bitrig commit from Martin Natano. OK zhuk@
2013-12-17ctype cleanups. Repeated re-audits of this sensitive area by okan andTheo de Raadt
myself, with a variety of other people spending some time as well. Thanks.
2013-04-05SECONDS is, in a highly theoretical way, not y2k38 safe. comment it.Ted Unangst
2007-10-15specifying int instead of just unsigned is better styleTheo de Raadt
2007-08-02backout last change; iff is right.Federico G. Schwindt
prompted by deraadt@
2007-08-02while i'm here: iff -> ifFederico G. Schwindt
2007-08-02fix memory leaks and one potential null deref found by coverity. from netbsd.Federico G. Schwindt
millert@ ok
2006-05-21Set the index of item[0], since it might not have been set beforeOtto Moerbeek
(A=0; A[1]=1) and do not use a static buffer in str_val, since the results might be used in a loop. Report from jared r r spiegel; help from Matthias Kilian; ok beck@
2006-03-13Interpret zero-filled numbers as decimal; PR 4213; from AlexeyOtto Moerbeek
Dobriyan; ok millert@ moritz@ jaredy@
2005-12-11fix a few name clashes with libc; found by lint. ok deraadt@Otto Moerbeek
2005-10-08Tell user which value of index is out of bounds. ok deraadt@Otto Moerbeek
2005-03-30lots of indentation cleanup, now ksh is readable like our other code.Theo de Raadt
double checked to make sure no binaries change, and eyed by niallo
2005-03-28spacingTheo de Raadt
2005-03-28spacingTheo de Raadt