Part no. 1
During recent fuzzing of yubihsm-shell, I've noticed that the following memory allocated in the main() is not properly free'd in the cleanup phase:
|
ctx.connector_list = calloc(1, sizeof(char *)); |
|
ctx.connector_list[0] = strdup(LOCAL_CONNECTOR_URL); |
The main_exit section doesn't touch it:
|
main_exit: |
|
|
|
cmdline_parser_free(&args_info); |
|
|
|
if (ctx.out != stdout && ctx.out != NULL) { |
|
fclose(ctx.out); |
|
} |
|
|
|
if (ctx.cacert) { |
|
free(ctx.cacert); |
|
} |
|
if (ctx.proxy) { |
|
free(ctx.proxy); |
|
} |
|
|
|
yh_exit(); |
Part no. 2
While looking at the pcc_failure cleanup section of the related parse_configured_connectors() function, I've noticed the following line, which I think is flawed and also leads to some resource leakage:
|
ctx->connector_list = NULL; |
It doesn't make sense to overwrite ctx->connector_list multiple times with NULL and then try to free() it.
The line should probably have been ctx->connector_list[i] = NULL;
Comment
Given the context, I do not consider either issue security related. The functional impact of the leaks is likely also low for regular CLI operation.
Part no. 1
During recent fuzzing of yubihsm-shell, I've noticed that the following memory allocated in the
main()is not properlyfree'd in the cleanup phase:yubihsm-shell/src/main.c
Line 1791 in 130a1cf
yubihsm-shell/src/main.c
Line 1798 in 130a1cf
The
main_exitsection doesn't touch it:yubihsm-shell/src/main.c
Lines 2718 to 2733 in 130a1cf
Part no. 2
While looking at the
pcc_failurecleanup section of the relatedparse_configured_connectors()function, I've noticed the following line, which I think is flawed and also leads to some resource leakage:yubihsm-shell/src/main.c
Line 1713 in 130a1cf
It doesn't make sense to overwrite
ctx->connector_listmultiple times withNULLand then try tofree()it.The line should probably have been
ctx->connector_list[i] = NULL;Comment
Given the context, I do not consider either issue security related. The functional impact of the leaks is likely also low for regular CLI operation.