]> diplodocus.org Git - nmh/commit
whom.c: Don't call rename(2) with source that's uninitialised.
authorRalph Corderoy <ralph@inputplus.co.uk>
Mon, 18 Sep 2017 11:43:28 +0000 (12:43 +0100)
committerRalph Corderoy <ralph@inputplus.co.uk>
Mon, 18 Sep 2017 12:10:13 +0000 (13:10 +0100)
commita27d1ec492f69d93a13821a0f236f0691d8683a3
treef3e99fd958cda5f4fe300d2363f2a68db3539340
parent41c25df5a669fa999155c6d29435856ffa5bcd36
whom.c: Don't call rename(2) with source that's uninitialised.

The intent is that two rename(2)s take place: to move a file to a
backup and then return it.  The first test controlled the generation of
the destination in the char array `backup' and calling the first
rename().  The second test used that same array for the restoring
rename(), but used a different test and so could run when the first
rename hadn't, and with an uninitialised array for the source filename.

The initialisation of `backup' and the first rename needed both
environment variables `mhdist' and `mhaltmsg' to be non-empty, and the
former to have a non-zero atoi(3) value.  The second rename ignored
`mhaltmsg'.  Bug pre-dates git.
uip/whom.c