From: Simon Wilkinson Date: Wed, 27 Feb 2013 10:34:59 +0000 (+0000) Subject: ubik: Avoid unlinking garbage X-Git-Tag: upstream/1.6.3^2~42 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=01ee0551ba5f3d874a9d012b7b362813bb4212f1;p=packages%2Fo%2Fopenafs.git ubik: Avoid unlinking garbage If SDISK_SendFail fails before the pathname to the temporary file has been constructed, then the failure handler will unlink stack garbage, with variable results. Initialise the string, and check to see if it has contents before calling unlink Reviewed-on: http://gerrit.openafs.org/9299 Reviewed-by: Derrick Brashear Tested-by: BuildBot Reviewed-by: Jeffrey Altman (cherry picked from commit 44e806431bec3149a78127f5d1003e84e3a0b072) Change-Id: I366de3ce15a5e1ea855eb45110ff7acf1748c377 Reviewed-on: http://gerrit.openafs.org/9538 Reviewed-by: Andrew Deason Reviewed-by: Stephan Wiesand Reviewed-by: Derrick Brashear Reviewed-by: Michael Meffie Tested-by: BuildBot --- diff --git a/src/ubik/remote.c b/src/ubik/remote.c index 75330a670..83ede63ee 100644 --- a/src/ubik/remote.c +++ b/src/ubik/remote.c @@ -495,6 +495,7 @@ SDISK_SendFile(struct rx_call *rxcall, afs_int32 file, /* send the file back to the requester */ dbase = ubik_dbase; + pbuffer[0] = '\0'; if ((code = ubik_CheckAuth(rxcall))) { DBHOLD(dbase); @@ -625,7 +626,8 @@ SDISK_SendFile(struct rx_call *rxcall, afs_int32 file, failed: if (code) { #ifndef OLD_URECOVERY - unlink(pbuffer); + if (pbuffer[0] != '\0') + unlink(pbuffer); /* Failed to sync. Allow reads again for now. */ if (dbase != NULL) { tversion.epoch = epoch;