pgpool2.git / summary / log / commit / refs

commit    802b78bf7ef8db2345fa7b38703ff5f78b2ce87a
Author:   Muhammad Usama <m.usama@gmail.com>
Date:     Tue Apr 04 11:03:52 2017 +0000

    Fix coverity reported issues of buffer overrun.
    
    Per coverity CID#1332216, CID#1332218, CID#1373253, CID#1373254 and CID#1373255


src/watchdog/wd_utils.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/watchdog/wd_utils.c b/src/watchdog/wd_utils.c index e3c5db2a2..b65acb060 100644 --- a/src/watchdog/wd_utils.c +++ b/src/watchdog/wd_utils.c @@ -194,7 +194,8 @@ wd_calc_hash(const char *str, int len, char *buf) /* calculate hash using md5 encrypt */ if (! pool_md5_encrypt(pass, username, strlen(username), tmp_buf + MD5_PASSWD_LEN + 1)) goto wd_calc_hash_error; - buf[(MD5_PASSWD_LEN+1)*2-1] = '\0'; + + tmp_buf[sizeof(tmp_buf)-1] = '\0'; if (! pool_md5_encrypt(tmp_buf+MD5_PASSWD_LEN+1, str, len, tmp_buf)) goto wd_calc_hash_error; [parent: 3aa4efcdee3c]