Commit: 2433842ea33bcb80a9c157cbac472efedae8c8d4
Parent: 176cf2e12a289f9f94666e188c79fa6cc1ff249b
Author: Bastien Nocera <hadess@hadess.net>
Committer: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Date: 2024-07-08 17:16:44
Tree: 22d039daba5974d41f8aeb8b3d4a4c9a8cb4437a

shared/shell: Fix fd leak if -s is passed multiple times Error: RESOURCE_LEAK (CWE-772): [#def37] [important] src/shared/shell.c:1305:5: open_fn: Returning handle opened by "open". [Note: The source code implementation of the function has been overridden by a user model.] src/shared/shell.c:1305:5: var_assign: Assigning: "data.init_fd" = handle returned from "open(optarg, 0)". src/shared/shell.c:1305:5: overwrite_var: Overwriting handle "data.init_fd" in "data.init_fd = open(optarg, 0)" leaks the handle. 1303| case 's': 1304| if (optarg) 1305|-> data.init_fd = open(optarg, O_RDONLY); 1306| if (data.init_fd < 0) 1307| printf("Unable to open %s: %s (%d)\n", optarg,

Diffstat

M src/shared/shell.c | 9 +++++- - - -

1 files changed, 5 insertions(+), 4 deletions(-)

View Full Diff | Patch