Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upGitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
| From 1de03e229771bb052061cf880b1ab7580d110020 Mon Sep 17 00:00:00 2001 | |
| From: EXL <exlmotodev@gmail.com> | |
| Date: Sun, 27 Oct 2019 22:07:32 +0700 | |
| Subject: [PATCH 2/2] Fix some Segmentation Faults | |
| Thanks to @kawaii_neko for the suggestion: | |
| https://www.linux.org.ru/gallery/screenshots/15311413?cid=15312641 | |
| --- | |
| malloc.c | 4 ++-- | |
| perl.y | 2 +- | |
| perly.c | 4 ++-- | |
| 3 files changed, 5 insertions(+), 5 deletions(-) | |
| diff --git a/malloc.c b/malloc.c | |
| index a1dfe9c..c829253 100644 | |
| --- a/malloc.c | |
| +++ b/malloc.c | |
| @@ -95,7 +95,7 @@ botch(s) | |
| #else | |
| #define ASSERT(p) | |
| #endif | |
| - | |
| +#if 0 | |
| char * | |
| malloc(nbytes) | |
| register unsigned nbytes; | |
| @@ -145,7 +145,7 @@ malloc(nbytes) | |
| #endif | |
| return ((char *)(p + 1)); | |
| } | |
| - | |
| +#endif | |
| /* | |
| * Allocate more memory to the indicated bucket. | |
| */ | |
| diff --git a/perl.y b/perl.y | |
| index 1ab769f..3083247 100644 | |
| --- a/perl.y | |
| +++ b/perl.y | |
| @@ -14,7 +14,7 @@ | |
| #include "util.h" | |
| #include "INTERN.h" | |
| #include "perl.h" | |
| -char *tokename[] = { | |
| +char tokename[][32] = { | |
| "256", | |
| "word", | |
| "append","open","write","select","close","loopctl", | |
| diff --git a/perly.c b/perly.c | |
| index fe945eb..ceb72c7 100644 | |
| --- a/perly.c | |
| +++ b/perly.c | |
| @@ -11,7 +11,7 @@ bool assume_n = FALSE; | |
| bool assume_p = FALSE; | |
| bool doswitches = FALSE; | |
| char *filename; | |
| -char *e_tmpname = "/tmp/perl-eXXXXXX"; | |
| +char e_tmpname[] = "/tmp/perl-eXXXXXX"; | |
| FILE *e_fp = Nullfp; | |
| ARG *l(); | |
| @@ -41,7 +41,7 @@ register char **env; | |
| #endif | |
| case 'e': | |
| if (!e_fp) { | |
| - mktemp(e_tmpname); | |
| + mkstemp(e_tmpname); | |
| e_fp = fopen(e_tmpname,"w"); | |
| } | |
| if (argv[1]) | |
| -- | |
| 2.23.0 | |