From: Fabian Keil Date: Tue, 19 Feb 2013 11:14:05 +0000 (+0000) Subject: Relocate a couple of assert()s X-Git-Tag: v_3_0_21~60 X-Git-Url: http://www.privoxy.org/gitweb/?p=privoxy.git;a=commitdiff_plain;h=ae9eeb30ff884c241cf50d39049dfda6bc942609 Relocate a couple of assert()s ... that could theoretically dereference NULL pointers. Found with ccc-analyzer. --- diff --git a/encode.c b/encode.c index 8676fc95..3ce4cc56 100644 --- a/encode.c +++ b/encode.c @@ -1,4 +1,4 @@ -const char encode_rcs[] = "$Id: encode.c,v 1.27 2012/03/09 17:55:49 fabiankeil Exp $"; +const char encode_rcs[] = "$Id: encode.c,v 1.28 2012/12/27 15:48:53 fabiankeil Exp $"; /********************************************************************* * * File : $Source: /cvsroot/ijbswa/current/encode.c,v $ @@ -158,9 +158,10 @@ char * html_encode(const char *s) } *p = '\0'; + + assert(strlen(buf) < buf_size); } - assert(strlen(buf) < buf_size); return(buf); } @@ -253,9 +254,9 @@ char * url_encode(const char *s) *p = '\0'; + assert(strlen(buf) < buf_size); } - assert(strlen(buf) < buf_size); return(buf); } @@ -448,9 +449,9 @@ char *percent_encode_url(const char *s) } } *p = '\0'; - } - assert(strlen(buf) < buf_size); + assert(strlen(buf) < buf_size); + } return(buf);