summaryrefslogtreecommitdiff
path: root/user/mcpp/02-gniibe-fixes.patch
diff options
context:
space:
mode:
authorA. Wilcox <AWilcox@Wilcox-Tech.com>2018-07-11 22:05:40 -0500
committerA. Wilcox <AWilcox@Wilcox-Tech.com>2018-07-11 22:05:40 -0500
commitd935bfa7ed9f9aa0a162d8bd3d413fe477f21fb8 (patch)
tree1def8e995d9ce9b39da3cb4bd3f269d75c07e519 /user/mcpp/02-gniibe-fixes.patch
parente120a4717450d84e0d37a120593d23bf5dd2e5e8 (diff)
downloadpackages-d935bfa7ed9f9aa0a162d8bd3d413fe477f21fb8.tar.gz
packages-d935bfa7ed9f9aa0a162d8bd3d413fe477f21fb8.tar.bz2
packages-d935bfa7ed9f9aa0a162d8bd3d413fe477f21fb8.tar.xz
packages-d935bfa7ed9f9aa0a162d8bd3d413fe477f21fb8.zip
user/mcpp: pull in, take, fix
Diffstat (limited to 'user/mcpp/02-gniibe-fixes.patch')
-rw-r--r--user/mcpp/02-gniibe-fixes.patch33
1 files changed, 33 insertions, 0 deletions
diff --git a/user/mcpp/02-gniibe-fixes.patch b/user/mcpp/02-gniibe-fixes.patch
new file mode 100644
index 000000000..cb5aa6c34
--- /dev/null
+++ b/user/mcpp/02-gniibe-fixes.patch
@@ -0,0 +1,33 @@
+Description: Simple fixes
+ * Fix freeing unmalloced memory
+ The memory of 'in_file' is not malloced, but points to argv[].
+ It is wrong to free it.
+ * When there is no input file specified by argv, it causes error
+ and fp_in == NULL. Check is needed to call fclose for fp_in.
+Author: NIIBE Yutaka
+
+## Fixes the issue reported at:
+## http://www.forallsecure.com/bug-reports/6b11b6fccda17cc467e055ccf7fec3fa2d89ec00/
+
+Index: mcpp-2.7.2/src/main.c
+===================================================================
+--- mcpp-2.7.2.orig/src/main.c 2013-07-09 03:03:05.610947658 +0000
++++ mcpp-2.7.2/src/main.c 2013-07-09 03:03:05.534947624 +0000
+@@ -428,16 +428,11 @@
+
+ fatal_error_exit:
+ #if MCPP_LIB
+- /* Free malloced memory */
+- if (mcpp_debug & MACRO_CALL) {
+- if (in_file != stdin_name)
+- free( in_file);
+- }
+ clear_filelist();
+ clear_symtable();
+ #endif
+
+- if (fp_in != stdin)
++ if (fp_in && fp_in != stdin)
+ fclose( fp_in);
+ if (fp_out != stdout)
+ fclose( fp_out);