Skip to content

Commit 8476f5b

Browse files
author
Sascha Schumann
committedDec 1, 2000
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.
1 parent a1510f9 commit 8476f5b

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed
 

‎ext/dba/dba.c

+6-4
Original file line numberDiff line numberDiff line change
@@ -206,21 +206,23 @@ static PHP_MSHUTDOWN_FUNCTION(dba)
206206
return SUCCESS;
207207
}
208208

209+
#include "ext/standard/php_smart_str.h"
209210

210211
static PHP_MINFO_FUNCTION(dba)
211212
{
212213
dba_handler *hptr;
213-
static char handlers[80], tmp[5];
214+
smart_str handlers = {0};
214215

215216
for(hptr = handler; hptr->name; hptr++) {
216-
sprintf(tmp, "%s ", hptr->name);
217-
strcat(handlers, tmp);
217+
smart_str_appends(&handlers, hptr->name);
218+
smart_str_appendc(&handlers, ' ');
218219
}
219220

220221
php_info_print_table_start();
221222
php_info_print_table_row(2, "DBA support", "enabled");
222-
php_info_print_table_row(2, "Supported handlers", handlers);
223+
php_info_print_table_row(2, "Supported handlers", handlers.c);
223224
php_info_print_table_end();
225+
smart_str_free(&handlers);
224226
}
225227

226228

0 commit comments

Comments
 (0)
Please sign in to comment.