From a5bedda935c8147517bcbb56858dd88288fdf9da Mon Sep 17 00:00:00 2001 From: Christof Hanke Date: Tue, 18 Jul 2017 12:04:11 +0200 Subject: [PATCH] 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 Reviewed-by: Benjamin Kaduk --- src/config/mkvers.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/config/mkvers.c b/src/config/mkvers.c index d0565cedf6..fca18d0e90 100644 --- a/src/config/mkvers.c +++ b/src/config/mkvers.c @@ -95,7 +95,7 @@ main(int argc, char **argv) char *baseDir; int argDir = 0; char *outputFile = NULL; - char outputFileBuf[sizeof(VERS_FILE) + 2]; + char outputFileBuf[sizeof(VERS_FILE) + 4]; struct stat sbuf; time_t versTime; int reBuild = 0;