From 78b04f2ac6f3060866ec90ae58653f1fb435d8ae Mon Sep 17 00:00:00 2001 From: =?utf8?q?Wilfried=20G=C3=B6esgens?= Date: Tue, 5 Jan 2010 22:58:11 +0000 Subject: [PATCH] * memset config before reading it * warn if the file didn't have the size we expected --- citadel/config.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/citadel/config.c b/citadel/config.c index bc42c559a..4c2509f00 100644 --- a/citadel/config.c +++ b/citadel/config.c @@ -67,7 +67,14 @@ void get_config(void) { strerror(errno)); exit(CTDLEXIT_CONFIG); } + memset(&config, 0, sizeof(struct config)); rv = fread((char *) &config, sizeof(struct config), 1, cfp); + if (rv != sizeof(struct config)) + { + fprintf(stderr, + "Warning: The config file %s has unexpected size. \n", + file_citadel_config); + } if (fstat(fileno(cfp), &st)) { perror(file_citadel_config); exit(CTDLEXIT_CONFIG); -- 2.30.2