Date: Fri, 23 Apr 2021 10:44:27 GMT From: Ryan Moeller <freqlabs@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: 550fcd830db7 - stable/11 - Fix leak in libc NFSv4 ACL flags parsing Message-ID: <202104231044.13NAiRiV071463@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch stable/11 has been updated by freqlabs: URL: https://cgit.FreeBSD.org/src/commit/?id=550fcd830db7e8d644795e5fc9bd83ef4604a1c1 commit 550fcd830db7e8d644795e5fc9bd83ef4604a1c1 Author: Andrew Walker <walker.aj325_gmail.com> AuthorDate: 2021-04-20 19:34:44 +0000 Commit: Ryan Moeller <freqlabs@FreeBSD.org> CommitDate: 2021-04-23 10:43:51 +0000 Fix leak in libc NFSv4 ACL flags parsing Free memory allocated by strdup() in parse_flags_verbose(). Submitted by: Andrew Walker <walker.aj325_gmail.com> Reported by: valgrind Reviewed by: allanjude, freqlabs, rpokala Sponsored by: iXsystems, Inc. Differential Revision: https://reviews.freebsd.org/D29871 (cherry picked from commit dd559118ab3f065ae230b324c3fe4bb1c9b7ca56) --- lib/libc/posix1e/acl_support_nfs4.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/libc/posix1e/acl_support_nfs4.c b/lib/libc/posix1e/acl_support_nfs4.c index 7dd7f04daaf3..ffed4446c1b2 100644 --- a/lib/libc/posix1e/acl_support_nfs4.c +++ b/lib/libc/posix1e/acl_support_nfs4.c @@ -141,9 +141,10 @@ parse_flags_verbose(const char *strp, uint32_t *var, int *try_compact) { int i, found, ever_found = 0; - char *str, *flag; + char *str, *flag, *to_free; str = strdup(strp); + to_free = str; *try_compact = 0; *var = 0; @@ -165,12 +166,12 @@ parse_flags_verbose(const char *strp, uint32_t *var, "invalid flag \"%s\"", flags_name, flag); else *try_compact = 1; - free(str); + free(to_free); return (-1); } } - free(str); + free(to_free); return (0); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202104231044.13NAiRiV071463>