Skip to content

Commit 6673d73

Browse files
author
Christian Schneider
committed
Make counter unsigned as signed integer overflow is undefined behaviour
1 parent 364fb17 commit 6673d73

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

ext/dba/dba.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ ZEND_BEGIN_MODULE_GLOBALS(dba)
5757
const char *default_handler;
5858
const dba_handler *default_hptr;
5959
HashTable connections;
60-
int connection_counter;
60+
unsigned int connection_counter;
6161
ZEND_END_MODULE_GLOBALS(dba)
6262

6363
ZEND_DECLARE_MODULE_GLOBALS(dba)
@@ -572,7 +572,7 @@ static void php_dba_open(INTERNAL_FUNCTION_PARAMETERS, bool persistent)
572572

573573
char *resource_key;
574574
size_t resource_key_len = spprintf(&resource_key, 0,
575-
"dba_%d_%d_%s_%s_%s", persistent, persistent ? 0 : DBA_G(connection_counter)++, ZSTR_VAL(path), ZSTR_VAL(mode), handler_str ? ZSTR_VAL(handler_str) : ""
575+
"dba_%d_%u_%s_%s_%s", persistent, persistent ? 0 : DBA_G(connection_counter)++, ZSTR_VAL(path), ZSTR_VAL(mode), handler_str ? ZSTR_VAL(handler_str) : ""
576576
);
577577

578578
if (persistent) {

0 commit comments

Comments
 (0)