diff options
author | CoprDistGit <infra@openeuler.org> | 2024-08-01 14:10:56 +0000 |
---|---|---|
committer | CoprDistGit <infra@openeuler.org> | 2024-08-01 14:10:56 +0000 |
commit | 5a4035746707b0966ba7c24d332cbf64dadb06d1 (patch) | |
tree | fdfc3b581aec7a5c6a8645b365e9ae9a23c37f61 /cscope-4-Avoid-double-free-via-double-fclose-in-changestring.patch | |
parent | 016a82dddce53ddb49ed3d206f0c36238aa01e38 (diff) |
automatic import of cscopeopeneuler24.03_LTSopeneuler23.09
Diffstat (limited to 'cscope-4-Avoid-double-free-via-double-fclose-in-changestring.patch')
-rw-r--r-- | cscope-4-Avoid-double-free-via-double-fclose-in-changestring.patch | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/cscope-4-Avoid-double-free-via-double-fclose-in-changestring.patch b/cscope-4-Avoid-double-free-via-double-fclose-in-changestring.patch new file mode 100644 index 0000000..8e862bf --- /dev/null +++ b/cscope-4-Avoid-double-free-via-double-fclose-in-changestring.patch @@ -0,0 +1,38 @@ +From f632c3fd86fce2c495a290dd70f5f09e3e7e7a28 Mon Sep 17 00:00:00 2001 +From: Hans-Bernhard Broeker <HBBroeker@T-Online.de> +Date: Sat, 13 Apr 2019 14:52:35 +0200 +Subject: [PATCH 5/9] Avoid double-free via double fclose in changestring. + +Mark closed FILE* by setting it to NULL, and check for that. + +Signed-off-by: Vladis Dronov <vdronov@redhat.com> +--- + src/command.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/src/command.c b/src/command.c +index 8740b11..dcb5278 100644 +--- a/src/command.c ++++ b/src/command.c +@@ -786,6 +786,7 @@ changestring(void) + } + fprintf(script, "w\nq\n!\n"); /* write and quit */ + fclose(script); ++ script = NULL; + + /* if any line was marked */ + if (anymarked == YES) { +@@ -803,7 +804,9 @@ changestring(void) + } + changing = NO; + mousemenu(); +- fclose(script); ++ if (script != NULL) { ++ fclose(script); ++ } + free(change); + return(anymarked); + } +-- +2.26.2 + |