diff options
author | cinap_lenrek <cinap_lenrek@felloff.net> | 2015-08-06 08:47:38 +0200 |
---|---|---|
committer | cinap_lenrek <cinap_lenrek@felloff.net> | 2015-08-06 08:47:38 +0200 |
commit | 2acb02f29ba24f3fed9bb3b8b0e0d870181eef50 (patch) | |
tree | a309a8f4bbd9b8acf6497b00fc7e56da340f9624 /sys/src/cmd/python/Python/codecs.c | |
parent | b89fcf2fe32195d0900b1a04ca98a4cb3cc62bf1 (diff) |
kernel: reject empty argv (argv[0] == nil) in sysexec()
when executing a script, we did advance argp0 unconditionally
to replace argv[0] with the script name. this fails when
argv[] is empty, then we'd advance argp0 past the nil terminator.
the alternative would be to *not* advance if *argp0 == nil, but that
would require another validaddr() check for a case that is unlikely
to have been anticipated in most programs being invoked as
libc's ARGBEGIN macro assumes argv[0] being non-nil as it also
unconditionally advances the argv pointer.
to keep us sane, we now reject an empty argv[]. on entry, we
verify that argv[] is valid for at least two elements:
- the program name argv[0], has to be non-nil
- the first potential nil terminator in argv[1]
when argv[0] == nil, we throw Ebadarg "bad arg in system call"
Diffstat (limited to 'sys/src/cmd/python/Python/codecs.c')
0 files changed, 0 insertions, 0 deletions