From: Wei Liu Date: Tue, 14 Jul 2015 16:41:11 +0000 (+0100) Subject: xl: correctly handle null extra config in main_config_update X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~2820 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=581d92166e6e9a5a132d46901298b87181b56f5a;p=xen.git xl: correctly handle null extra config in main_config_update Don't dereference NULL. Also fixed a typo in error string while I was there. Signed-off-by: Wei Liu Acked-by: Ian Jackson --- diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c index 607db4e998..888f729fe4 100644 --- a/tools/libxl/xl_cmdimpl.c +++ b/tools/libxl/xl_cmdimpl.c @@ -5010,9 +5010,9 @@ int main_config_update(int argc, char **argv) if (rc) { fprintf(stderr, "Failed to read config file: %s: %s\n", filename, strerror(errno)); free(extra_config); return ERROR_FAIL; } - if (strlen(extra_config)) { + if (extra_config && strlen(extra_config)) { if (config_len > INT_MAX - (strlen(extra_config) + 2 + 1)) { - fprintf(stderr, "Failed to attach extra configration\n"); + fprintf(stderr, "Failed to attach extra configuration\n"); exit(1); } /* allocate space for the extra config plus two EOLs plus \0 */