summaryrefslogtreecommitdiffstats
path: root/src/fuse
diff options
context:
space:
mode:
authorSimon Rettberg2015-12-10 15:27:36 +0100
committerSimon Rettberg2015-12-10 15:27:36 +0100
commit0f6922fac267f4eabe2829529162b28ea464e952 (patch)
tree6cf8f2084dbf0840d17858ef00152908899bee0c /src/fuse
parent[SERVER] Remove redundant range check (diff)
downloaddnbd3-0f6922fac267f4eabe2829529162b28ea464e952.tar.gz
dnbd3-0f6922fac267f4eabe2829529162b28ea464e952.tar.xz
dnbd3-0f6922fac267f4eabe2829529162b28ea464e952.zip
[FUSE] Fix stack overflow caused by stats data
Diffstat (limited to 'src/fuse')
-rw-r--r--src/fuse/main.c8
1 files changed, 5 insertions, 3 deletions
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";