cvs: php4 /ext/dba dba.c

From: Date: Fri, 01 Dec 2000 12:29:29 +0000
Subject: cvs: php4 /ext/dba dba.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-2841@lists.php.net to get a copy of this message
sas Fri Dec 1 04:29:29 2000 EDT Modified files: /php4/ext/dba dba.c Log: Please avoid potential buffer overflows in new code. If you deal with strings, consider storing the string length along with the string data. That will make your life easier. Index: php4/ext/dba/dba.c diff -u php4/ext/dba/dba.c:1.27 php4/ext/dba/dba.c:1.28 --- php4/ext/dba/dba.c:1.27 Thu Nov 30 17:25:36 2000 +++ php4/ext/dba/dba.c Fri Dec 1 04:29:29 2000 @@ -27,7 +27,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: dba.c,v 1.27 2000/12/01 01:25:36 sniper Exp $ */ +/* $Id: dba.c,v 1.28 2000/12/01 12:29:29 sas Exp $ */ #include "php.h" @@ -206,21 +206,23 @@ return SUCCESS; } +#include "ext/standard/php_smart_str.h" static PHP_MINFO_FUNCTION(dba) { dba_handler *hptr; - static char handlers[80], tmp[5]; + smart_str handlers = {0}; for(hptr = handler; hptr->name; hptr++) { - sprintf(tmp, "%s ", hptr->name); - strcat(handlers, tmp); + smart_str_appends(&handlers, hptr->name); + smart_str_appendc(&handlers, ' '); } php_info_print_table_start(); php_info_print_table_row(2, "DBA support", "enabled"); - php_info_print_table_row(2, "Supported handlers", handlers); + php_info_print_table_row(2, "Supported handlers", handlers.c); php_info_print_table_end(); + smart_str_free(&handlers); }

« previous php.cvs (#2841) next »