[gnutls-devel] GnuTLS | Fix memleaks and handle allocation error (!1993)
Read-only notification of GnuTLS library development activities
gnutls-devel at lists.gnutls.org
Mon Jul 28 06:17:28 CEST 2025
Daiki Ueno created a merge request: https://gitlab.com/gnutls/gnutls/-/merge_requests/1993
Project:Branches: dueno/gnutls:wip/purdue-university1/memleaks to gnutls/gnutls:master
Author: Daiki Ueno
<!-- Add a description of the new feature/bug fix. Reference any relevant bugs. -->
This includes the following fixes from Jiasheng Jiang, origianlly in !1981, !1982, !1983, !1984, !1985, !1986, and !1956.
* Replace with statically allocated buffer
Replace with statically allocated buffer to avoid potential NULL pointer
dereference.
Fixes: 1fb6d1b5 ("fips140-2: moved PCT-test in wrap_nettle_generate_keys")
* lib/hello_ext.c: Add check for gnutls_strdup()
Add check for the return value of gnutls_strdup() to avoid potential NULL pointer dereference.
Fixes: 5bba569b4 ("gnutls_session_ext_register: keep track of extension name")
* lib/file.c: Add check for gnutls_malloc()
Add check for the return value of gnutls_malloc() to avoid potential NULL pointer dereference.
Fixes: d1428c0f9 ("helper.c -> file.c")
* lib/ext/srp.c: Add gnutls_free() to avoid memory leak
Add gnutls_free() to free priv->username if the allocation of priv->password fails to avoid memory leak.
Moreover, replace "return" with "goto" to avoid memory leak.
Fixes: a1a15422 ("Fixes and memory leak elimination in SRP authentication.")
* lib/ext/srp.c: Add gnutls_free() in the error path
Add gnutls_free() in the error path to avoid potential memory leak if BUFFER_POP_DATUM fails.
Fixes: 8b038ab97 ("The auth_ and ext_ files were moved to respective directories.")
* lib/cert-cred-rawpk.c: Add gnutls_free() and gnutls_pcert_deinit() in the error paths
Add gnutls_free() and gnutls_pcert_deinit() in the error paths to avoid potential memory leak.
Fixes: 565efaeac ("Implemented support for raw public-key functionality (RFC7250).")
* fuzz/gnutls_srp_server_fuzzer.c: Add check for gnutls_malloc()
Add check for the return value of gnutls_malloc() to avoid potential NULL pointer dereference.
Fixes: 5bb8a18b0 ("fuzzer: Initial check in for improved fuzzing")
## Checklist
* [ ] Commits have `Signed-off-by:` with name/author being identical to the commit author
* [ ] Code modified for feature
* [ ] Test suite updated with functionality tests
* [ ] Test suite updated with negative tests
* [ ] Documentation updated / NEWS entry present (for non-trivial changes)
* [ ] CI timeout is 2h or higher (see Settings/CICD/General pipelines/Timeout)
## Reviewer's checklist:
* [ ] Any issues marked for closing are addressed
* [ ] There is a test suite reasonably covering new functionality or modifications
* [ ] Function naming, parameters, return values, types, etc., are consistent and according to `CONTRIBUTION.md`
* [ ] This feature/change has adequate documentation added
* [ ] No obvious mistakes in the code
--
Reply to this email directly or view it on GitLab: https://gitlab.com/gnutls/gnutls/-/merge_requests/1993
You're receiving this email because of your account on gitlab.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.gnupg.org/pipermail/gnutls-devel/attachments/20250728/85010d9c/attachment-0001.html>
More information about the Gnutls-devel
mailing list