From: Muhammad Usama Date: Thu, 26 Jan 2017 20:48:38 +0000 (+0500) Subject: Fixing 0000280: stack smashing detected X-Git-Tag: V3_3_14~6 X-Git-Url: http://git.postgresql.org/gitweb/static/gitweb.js?a=commitdiff_plain;h=ee5dd025b84bc511fdec82178878988802404abb;p=pgpool2.git Fixing 0000280: stack smashing detected It was a buffer overflow in wd_get_cmd function. --- diff --git a/watchdog/wd_if.c b/watchdog/wd_if.c index fc472a427..169b8958f 100644 --- a/watchdog/wd_if.c +++ b/watchdog/wd_if.c @@ -147,12 +147,12 @@ wd_get_cmd(char * buf, char * cmd) { int i,j; i = 0; - while(isspace(cmd[i]) != 0) + while(cmd[i] && isspace(cmd[i]) != 0) { i++; } j = 0; - while(isspace(cmd[i]) == 0) + while(cmd[i] && isspace(cmd[i]) == 0) { buf[j++] = cmd[i++]; }