git: 2b25564af6f9 - stable/12 - OpenBSM: fix free() in au_read_rec error case
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 27 Oct 2022 00:25:41 UTC
The branch stable/12 has been updated by emaste:
URL: https://cgit.FreeBSD.org/src/commit/?id=2b25564af6f9d1303fb92b8dfd3a36f5d7fc3c34
commit 2b25564af6f9d1303fb92b8dfd3a36f5d7fc3c34
Author: Ed Maste <emaste@FreeBSD.org>
AuthorDate: 2022-10-24 13:45:59 +0000
Commit: Ed Maste <emaste@FreeBSD.org>
CommitDate: 2022-10-27 00:25:33 +0000
OpenBSM: fix free() in au_read_rec error case
buf is a char ** and *buf is the allocated buffer.
PR: 267050
Reported by: Robert Morris <rtm@lcs.mit.edu>
MFC after: 3 days
Sponsored by: The FreeBSD Foundation
(cherry picked from commit c61b3f7de9a0a39d2bc78e3e78d148c369e706a5)
(cherry picked from commit 889dcb5e9b2ff4160c313b31cfa53106af2a5b0c)
---
contrib/openbsm/libbsm/bsm_io.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/contrib/openbsm/libbsm/bsm_io.c b/contrib/openbsm/libbsm/bsm_io.c
index 43cf7e9990c1..4b89ccb8b59c 100644
--- a/contrib/openbsm/libbsm/bsm_io.c
+++ b/contrib/openbsm/libbsm/bsm_io.c
@@ -4597,7 +4597,7 @@ au_read_rec(FILE *fp, u_char **buf)
if (fread(bptr, 1, ntohs(filenamelen), fp) <
ntohs(filenamelen)) {
- free(buf);
+ free(*buf);
errno = EINVAL;
return (-1);
}