cvs: php4 /ext/informix ifx.ec

From: Date: Thu, 27 Feb 2003 08:56:15 +0000
Subject: cvs: php4 /ext/informix ifx.ec
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-19224@lists.php.net to get a copy of this message
nobbie Thu Feb 27 03:56:15 2003 EDT Modified files: /php4/ext/informix ifx.ec Log: - Fixed possible Segfault in ifx_errormsg() using malloc() instead of emalloc() Index: php4/ext/informix/ifx.ec diff -u php4/ext/informix/ifx.ec:1.84 php4/ext/informix/ifx.ec:1.85 --- php4/ext/informix/ifx.ec:1.84 Tue Feb 25 01:59:13 2003 +++ php4/ext/informix/ifx.ec Thu Feb 27 03:56:14 2003 @@ -21,7 +21,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: ifx.ec,v 1.84 2003/02/25 06:59:13 nobbie Exp $ */ +/* $Id: ifx.ec,v 1.85 2003/02/27 08:56:14 nobbie Exp $ */ /* ------------------------------------------------------------------- * if you want a function reference : "grep '^\*\*' ifx.ec" will give @@ -1650,15 +1650,14 @@ break; } - maxmsglen = 255; + maxmsglen = 10; msglen = maxmsglen; /* Some bug fix, rgetlmsg doesnt always set the value */ - ifx_errmsg = (char *)malloc(maxmsglen + 1); + ifx_errmsg = (char *)emalloc(maxmsglen + 1); if (ifx_errorcode != 0) { rgetlmsg(ifx_errorcode, ifx_errmsg, maxmsglen, &msglen); if (msglen > maxmsglen) { - maxmsglen = msglen + 1; - free(ifx_errmsg); - ifx_errmsg = (char *)malloc(maxmsglen + 1); + maxmsglen = msglen; + ifx_errmsg = (char *)erealloc(ifx_errmsg, maxmsglen + 1); rgetlmsg(ifx_errorcode, ifx_errmsg, maxmsglen, &msglen); } } else { @@ -1667,7 +1666,7 @@ returnmsg = (char *) emalloc(strlen(ifx_errmsg) + 128); sprintf(returnmsg, ifx_errmsg, sqlca.sqlerrm); - free(ifx_errmsg); + efree(ifx_errmsg); RETURN_STRING(returnmsg,0); } /* }}} */

« previous php.cvs (#19224) next »