From: Ralph Corderoy Date: Tue, 23 Jan 2018 09:18:34 +0000 (+0000) Subject: mhshow: Avoid SEGV when user's command has two or fewer words. X-Git-Url: https://diplodocus.org/git/nmh/commitdiff_plain/20fdce3e9137be985ffb22a2c97c51bcd45f72e0?hp=20fdce3e9137be985ffb22a2c97c51bcd45f72e0 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. ---