From 86af874c0b011cc34e49ecf36bc3e0ca3223d5f5 Mon Sep 17 00:00:00 2001 From: krypt-n Date: Mon, 10 Nov 2014 20:33:07 +0100 Subject: [PATCH] Fixes segfault on color params --- bar.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/bar.c b/bar.c index 44f9222..a720f12 100644 --- a/bar.c +++ b/bar.c @@ -1252,6 +1252,7 @@ main (int argc, char **argv) ugc = fgc; + char* end_ptr = NULL; char ch; while ((ch = getopt(argc, argv, "hg:bdf:a:pu:B:F:")) != -1) { switch (ch) { @@ -1286,10 +1287,10 @@ main (int argc, char **argv) bu = strtoul(optarg, NULL, 10); break; case 'B': - dbgc = bgc = parse_color(optarg, NULL, scr->black_pixel); + dbgc = bgc = parse_color(optarg, &end_ptr, scr->black_pixel); break; case 'F': - dfgc = fgc = parse_color(optarg, NULL, scr->white_pixel); + dfgc = fgc = parse_color(optarg, &end_ptr, scr->white_pixel); break; } }