cvs: php4 /ext/xslt sablot.c

From: Date: Sat, 15 Sep 2001 16:00:46 +0000
Subject: cvs: php4 /ext/xslt sablot.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-7423@lists.php.net to get a copy of this message
sterling Sat Sep 15 12:00:46 2001 EDT Modified files: /php4/ext/xslt sablot.c Log: properly grab field and value pairs, plus avoid a segfault when errmsg isn't defined Index: php4/ext/xslt/sablot.c diff -u php4/ext/xslt/sablot.c:1.22 php4/ext/xslt/sablot.c:1.23 --- php4/ext/xslt/sablot.c:1.22 Sun Sep 9 09:29:23 2001 +++ php4/ext/xslt/sablot.c Sat Sep 15 12:00:46 2001 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: sablot.c,v 1.22 2001/09/09 13:29:23 derick Exp $ */ +/* $Id: sablot.c,v 1.23 2001/09/15 16:00:46 sterling Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -1435,7 +1435,7 @@ char *ptr; /* Pointer to the location of the ':' (separator) */ int pos; /* Position of the ':' (separator) */ int len; /* Length of the string */ - + len = strlen(*fields); /* Grab the separator's position */ @@ -1507,8 +1507,8 @@ key = emalloc(pos + 1); val = emalloc((len - pos) + 1); - strlcpy(key, *fields, pos); - strlcpy(val, *fields + pos + 1, len - pos - 1); + strlcpy(key, *fields, pos + 1); + strlcpy(val, *fields + pos + 1, len - pos); /* Check to see whether or not we want to save the data */ if (!strcmp(key, "msg")) { @@ -1517,7 +1517,7 @@ else if (!strcmp(key, "line")) { errline = estrdup(val); } - + /* Cleanup */ if (key) efree(key); if (val) efree(val); @@ -1529,6 +1529,10 @@ if (!errline) { errline = estrndup("none", sizeof("none") - 1); + } + + if (!errmsg) { + errmsg = estrndup("unkown error", sizeof("unkown error") - 1); } /* Allocate the message buffer and copy the data onto it */

« previous php.cvs (#7423) next »