From 29b27fb282c24ab3f8a24804a47c95cb23c14b4e Mon Sep 17 00:00:00 2001 From: Jaromir Capik Date: Wed, 20 Aug 2014 19:14:13 +0200 Subject: [PATCH] watch: fixing uninitialized endptr in the previous commit And increasing the ANSI buffer size from 10 to 100. --- watch.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/watch.c b/watch.c index 37fd4ea0..5bd4d269 100644 --- a/watch.c +++ b/watch.c @@ -79,7 +79,7 @@ static int show_title = 2; /* number of lines used, 2 or 0 */ static int precise_timekeeping = 0; #define min(x,y) ((x) > (y) ? (y) : (x)) -#define MAX_ANSIBUF 10 +#define MAX_ANSIBUF 100 static void __attribute__ ((__noreturn__)) usage(FILE * out) @@ -168,7 +168,7 @@ static void process_ansi(FILE * fp) * escape sequence "[0;1;31m". There can be 1 or more * attributes to apply, but typically there are between 1 and 3. */ - for (numstart = buf; *endptr != '\0'; numstart = endptr + 1) + for (endptr = numstart = buf; *endptr != '\0'; numstart = endptr + 1) set_ansi_attribute(strtol(numstart, &endptr, 10)); }