]> diplodocus.org Git - nmh/commitdiff
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)
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.


No differences found