mkvers: fix potential buffer overflow

The space allocated for outputFileBuf is only 2 bytes larger than
sizeof(VERS_FILE). But we add potentially 4 extra bytes like
".txt" or ".xml". Just allocate enough space for all file suffices.

Change-Id: Ic0f97590be208deaf9c4a5c25e21056ea9d2cd6f
Reviewed-on: https://gerrit.openafs.org/12657
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
This commit is contained in:
Christof Hanke 2017-07-18 12:04:11 +02:00 committed by Benjamin Kaduk
parent d7211350ee
commit a5bedda935

View File

@ -95,7 +95,7 @@ main(int argc, char **argv)
char *baseDir; char *baseDir;
int argDir = 0; int argDir = 0;
char *outputFile = NULL; char *outputFile = NULL;
char outputFileBuf[sizeof(VERS_FILE) + 2]; char outputFileBuf[sizeof(VERS_FILE) + 4];
struct stat sbuf; struct stat sbuf;
time_t versTime; time_t versTime;
int reBuild = 0; int reBuild = 0;