]> diplodocus.org Git - nmh/commit
mhshow: Avoid SEGV when user's command has two or fewer words.
authorRalph Corderoy <ralph@inputplus.co.uk>
Tue, 23 Jan 2018 09:18:34 +0000 (09:18 +0000)
committerRalph Corderoy <ralph@inputplus.co.uk>
Tue, 23 Jan 2018 09:24:45 +0000 (09:24 +0000)
commit20fdce3e9137be985ffb22a2c97c51bcd45f72e0
tree1f5c38f975f8b425875f2e0eff17f6bc5172a1ba
parentc349c172bd195190c0ddb7754644f16ba8545fda
mhshow: Avoid SEGV when user's command has two or fewer words.

After argsplit() returned a NULL-terminated vector, the existing NULL
was overwritten with another and the vector index then incremented.
This made the test for whether vec[2] was available out by one resulting
in NULL being used and printed.

This plucking of the third word is a faulty assumption as argsplit()
doesn't always return ["sh", "-c", ...], but add a new test script for
it to avoid regression and so that the script can be expanded with more
related tests.

Fixes 7559e1ebf.
Makefile.am
test/mhshow/test-exec [new file with mode: 0755]
uip/mhshowsbr.c