| 1 |
From: Brian May <[email protected]> |
| 2 |
Date: Thu, 8 Aug 2024 10:43:18 +1000 |
| 3 |
Subject: add-include-support-3 |
| 4 |
|
| 5 |
commit 23ee804e9d23ed83a3a502501dbe5fe50ab9094a |
| 6 |
Author: Jeffrey Altman <[email protected]> |
| 7 |
Date: Sat Mar 18 11:06:45 2017 -0400 |
| 8 |
|
| 9 |
lib/krb5: krb5_config_parse_file_multi use after free |
| 10 |
|
| 11 |
If the file is not a regular file, the 'fname' buffer will be freed |
| 12 |
before it is passed to the krb5_set_error_message() routine. That |
| 13 |
this is true is not obvious from code inspection but 'newfname' |
| 14 |
and 'fname' refer to the same memory. |
| 15 |
|
| 16 |
Change-Id: I7780eae9ceaf01b245df488a2f7d7f406770864f |
| 17 |
|
| 18 |
Origin: upstream, https://github.com/heimdal/heimdal/commit/23ee804e9d23ed83a3a502501dbe5fe50ab9094a |
| 19 |
Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1074775 |
| 20 |
Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/heimdal/+bug/2037321 |
| 21 |
Last-Update: 2024-07-05 |
| 22 |
--- |
| 23 |
lib/krb5/config_file.c | 2 +- |
| 24 |
1 file changed, 1 insertion(+), 1 deletion(-) |
| 25 |
|
| 26 |
diff --git a/lib/krb5/config_file.c b/lib/krb5/config_file.c |
| 27 |
index 947c302..e1754f0 100644 |
| 28 |
--- a/lib/krb5/config_file.c |
| 29 |
+++ b/lib/krb5/config_file.c |
| 30 |
@@ -661,9 +661,9 @@ krb5_config_parse_file_multi (krb5_context context, |
| 31 |
if (!S_ISREG(st.st_mode)) { |
| 32 |
(void) fclose(f.f); |
| 33 |
context->config_include_depth--; |
| 34 |
- free(newfname); |
| 35 |
krb5_set_error_message(context, EISDIR, "not a regular file %s: %s", |
| 36 |
fname, strerror(EISDIR)); |
| 37 |
+ free(newfname); |
| 38 |
return EISDIR; |
| 39 |
} |
| 40 |
|