Skip to content

MEMORY_LEAK in phpdbg_prompt.c #12675

Closed
Closed
@ellena13

Description

@ellena13

Description

Dynamic memory, referenced by res, is allocated at phpdbg_utils.c:154 :

PHPDBG_API char *phpdbg_resolve_path(const char *path) /* {{{ */
{
char resolved_name[MAXPATHLEN];
if (expand_filepath(path, resolved_name) == NULL) {
return NULL;
}
return strdup(resolved_name);
} /* }}} */

by calling function phpdbg_resolve_path at phpdbg_prompt.c:405 and lost at phpdbg_prompt.c:411 :

char *res = phpdbg_resolve_path(param->str);
size_t res_len = strlen(res);
if ((res_len != PHPDBG_G(exec_len)) || (memcmp(res, PHPDBG_G(exec), res_len) != SUCCESS)) {
if (PHPDBG_G(in_execution)) {
if (phpdbg_ask_user_permission("Do you really want to stop execution to set a new execution context?") == FAILURE) {
return FAILURE;
}

The allocated memory will be lost even if the condition at phpdbg_prompt.c:408 is false.

Found by Linux Verification Center (portal.linuxtesting.ru) with SVACE.

Author E. Bykhanova.

PHP Version

PHP 8.2.3

Operating System

ALT Linux

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions