summaryrefslogtreecommitdiff
path: root/src/regress/lib/libssl/tlsfuzzer/tlsfuzzer.py
diff options
context:
space:
mode:
authortb <>2020-09-24 19:29:09 +0000
committertb <>2020-09-24 19:29:09 +0000
commit019d699d5cdb8e0fbd506ab1f8a1b1c872f69dd3 (patch)
tree83099f355e9ebf9fa764f4ff2037fb540437baf8 /src/regress/lib/libssl/tlsfuzzer/tlsfuzzer.py
parent8b60c9a777523278ddbc7a43f410248840567f0d (diff)
downloadopenbsd-019d699d5cdb8e0fbd506ab1f8a1b1c872f69dd3.tar.gz
openbsd-019d699d5cdb8e0fbd506ab1f8a1b1c872f69dd3.tar.bz2
openbsd-019d699d5cdb8e0fbd506ab1f8a1b1c872f69dd3.zip
Fix a number of leaks in the UI_dup_* functions
If any of general_allocate_{prompt,string,boolean}() fail, the UI_dup_* functions may leak the strings they strduped beforehand. Instead, use strdup inside these functions, so we can free as necessary. This makes the UI_add_* and UI_dup_* simple wrappers around general_allocate_{string,boolean}() that differ only in passing a Boolean that indicates whether or not to use strdup. Make a general cleanup pass over these functions, simplify the logic and make it overall a bit easier to follow. While there, use strcspn() instead of a handrolled variant. The only changes in behavior are that ERR_R_MALLOC_FAILURE is now pushed onto the stack a bit more often and that UI_dup_input_string() now returns -1 on failure to dup prompt like all the other UI_dup_* functions. This is not a problem since the manual already documents that errors are signaled with <= 0. The only consumer of this function according to Debian's codesearch is libp11, I sent them a PR to fix their (already broken) error handling. Addresses about 10 errors thrown by the LLVM static analyzer in ui/. ok jsing
Diffstat (limited to 'src/regress/lib/libssl/tlsfuzzer/tlsfuzzer.py')
0 files changed, 0 insertions, 0 deletions