From 0f6922fac267f4eabe2829529162b28ea464e952 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Thu, 10 Dec 2015 15:27:36 +0100 Subject: [FUSE] Fix stack overflow caused by stats data --- src/fuse/main.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/fuse') diff --git a/src/fuse/main.c b/src/fuse/main.c index 4f8f857..eb4566a 100644 --- a/src/fuse/main.c +++ b/src/fuse/main.c @@ -318,9 +318,11 @@ int main(int argc, char *argv[]) logInfo.receivedBytes = 0; logInfo.imageSize = imageSize; logInfo.imageBlockCount = ( imageSize + 4095 ) / 4096; - uint8_t tmpShrt[logInfo.imageBlockCount]; - memset( tmpShrt, 0, sizeof tmpShrt ); - logInfo.blockRequestCount = tmpShrt; + if ( useDebug ) { + logInfo.blockRequestCount = calloc( logInfo.imageBlockCount, sizeof(uint8_t) ); + } else { + logInfo.blockRequestCount = NULL; + } // Since dnbd3 is always read only and the remote image will not change newArgv[newArgc++] = "-o"; -- cgit v1.2.3-55-g7522