From: Fabian Keil Date: Mon, 23 Jul 2012 12:46:40 +0000 (+0000) Subject: In ssplit(), assert() that the last substring already is nul-terminated X-Git-Tag: v_3_0_20~309 X-Git-Url: http://www.privoxy.org/gitweb/user-manual/copyright.html?a=commitdiff_plain;h=dc4e311bcfc764e27d364cf64666c32555a32c22;p=privoxy.git In ssplit(), assert() that the last substring already is nul-terminated --- diff --git a/ssplit.c b/ssplit.c index 348f5354..9e1fd3d7 100644 --- a/ssplit.c +++ b/ssplit.c @@ -1,4 +1,4 @@ -const char ssplit_rcs[] = "$Id: ssplit.c,v 1.17 2012/07/23 12:44:30 fabiankeil Exp $"; +const char ssplit_rcs[] = "$Id: ssplit.c,v 1.18 2012/07/23 12:46:18 fabiankeil Exp $"; /********************************************************************* * * File : $Source: /cvsroot/ijbswa/current/ssplit.c,v $ @@ -37,6 +37,7 @@ const char ssplit_rcs[] = "$Id: ssplit.c,v 1.17 2012/07/23 12:44:30 fabiankeil E #include #include +#include #include "ssplit.h" #include "miscutil.h" @@ -152,6 +153,8 @@ int ssplit(char *str, const char *delim, char *vec[], size_t vec_len) } } /* null terminate the substring */ + /* XXX: this shouldn't be necessary, so assert that it isn't. */ + assert(*str == '\0'); *str = '\0'; return(vec_count);