From: Sterling Hughes Date: Sat, 15 Sep 2001 16:05:38 +0000 (+0000) Subject: fix this in a couple of other places and use estrndup() when we have the X-Git-Tag: PRE_SUBST_Z_MACROS~99 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ca5fdbf5375bd2c68031386c83f9c31767631e97;p=php fix this in a couple of other places and use estrndup() when we have the string length. --- diff --git a/ext/xslt/sablot.c b/ext/xslt/sablot.c index 26af287734..5bbe97f57a 100644 --- a/ext/xslt/sablot.c +++ b/ext/xslt/sablot.c @@ -1301,18 +1301,18 @@ static MH_ERROR error_log(void *user_data, SablotHandle proc, MH_ERROR code, MH_ 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")) { - errmsg = estrndup(val, len - pos -1); + errmsg = estrndup(val, len - pos); } else if (!strcmp(key, "type")) { - errtype = estrndup(val, len - pos - 1); + errtype = estrndup(val, len - pos); } else if (!strcmp(key, "line")) { - errline = estrndup(val, len - pos - 1); + errline = estrndup(val, len - pos); } /* Cleanup */ @@ -1449,8 +1449,8 @@ static MH_ERROR error_print(void *user_data, SablotHandle proc, MH_ERROR code, M 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); /* Add it */ add_assoc_stringl_ex(argv[3], key, pos, val, len - pos - 1, 1); @@ -1512,10 +1512,10 @@ static MH_ERROR error_print(void *user_data, SablotHandle proc, MH_ERROR code, M /* Check to see whether or not we want to save the data */ if (!strcmp(key, "msg")) { - errmsg = estrdup(val); + errmsg = estrndup(val, len - pos); } else if (!strcmp(key, "line")) { - errline = estrdup(val); + errline = estrndup(val, len - pos); } /* Cleanup */