diff options
Diffstat (limited to 'development/opencomal/patches/02-vsprintf.diff')
-rw-r--r-- | development/opencomal/patches/02-vsprintf.diff | 93 |
1 files changed, 93 insertions, 0 deletions
diff --git a/development/opencomal/patches/02-vsprintf.diff b/development/opencomal/patches/02-vsprintf.diff new file mode 100644 index 0000000000000..4f254064ddc96 --- /dev/null +++ b/development/opencomal/patches/02-vsprintf.diff @@ -0,0 +1,93 @@ +diff -Naur opencomal-0.2.6/src/pdcexec.c opencomal-0.2.6.patched/src/pdcexec.c +--- opencomal-0.2.6/src/pdcexec.c 2002-11-30 09:58:16.000000000 -0500 ++++ opencomal-0.2.6.patched/src/pdcexec.c 2017-12-10 17:29:51.489206949 -0500 +@@ -25,6 +25,7 @@ + #include "pdcexec.h" + #include "pdcdsys.h" + ++#include <stdarg.h> + #include <fcntl.h> + #include <string.h> + #include <sys/stat.h> +@@ -42,10 +43,13 @@ + + PUBLIC void run_error(int error, char *s, ...) + { ++ va_list ap; + char *buf; + char buf2[MAX_LINELEN]; + +- vsprintf(buf2, s, (char *) &s + sizeof(s)); ++ va_start(ap, s); ++ vsprintf(buf2, s, ap); ++ va_end(ap); + + curenv->error = curenv->lasterr = error; + mem_free(curenv->lasterrmsg); +diff -Naur opencomal-0.2.6/src/pdcmisc.c opencomal-0.2.6.patched/src/pdcmisc.c +--- opencomal-0.2.6/src/pdcmisc.c 2017-12-10 17:23:13.344206273 -0500 ++++ opencomal-0.2.6.patched/src/pdcmisc.c 2017-12-10 17:24:52.465206441 -0500 +@@ -18,6 +18,7 @@ + #include "pdcexec.h" + #include "pdclist.h" + ++#include <stdarg.h> + #include <string.h> + #include <math.h> + #include <fcntl.h> +@@ -58,9 +59,12 @@ + + PUBLIC void my_printf(int stream, int newline, char *s, ...) + { ++ va_list ap; + char buf[MAX_LINELEN]; + +- vsprintf(buf, s, (char *) &s + sizeof(s)); ++ va_start(ap, s); ++ vsprintf(buf, s, ap); ++ va_end(ap); + my_put(stream, buf, -1L); + + if (newline) +@@ -70,9 +74,12 @@ + + PUBLIC void fatal(char *s, ...) + { ++ va_list ap; + char buf[140]; + +- vsprintf(buf, s, (char *) &s + sizeof(s)); ++ va_start(ap, s); ++ vsprintf(buf, s, ap); ++ va_end(ap); + my_printf(MSG_ERROR, 1, "FATAL error: %s", buf); + + longjmp(RESTART, ERR_FATAL); +diff -Naur opencomal-0.2.6/src/pdcparss.c opencomal-0.2.6.patched/src/pdcparss.c +--- opencomal-0.2.6/src/pdcparss.c 2002-11-30 03:22:16.000000000 -0500 ++++ opencomal-0.2.6.patched/src/pdcparss.c 2017-12-10 17:29:21.935206898 -0500 +@@ -16,6 +16,8 @@ + #include "pdcstr.h" + #include "pdcparss.h" + ++#include <stdarg.h> ++ + PRIVATE int pars_error_happened = 0; + PRIVATE char pars_errtxt[MAX_LINELEN]; + +@@ -282,11 +284,14 @@ + + PUBLIC void pars_error(char *s, ...) + { ++ va_list ap; + if (pars_error_happened) + return; + + pars_error_happened = lex_pos(); +- vsprintf(pars_errtxt, s, (char *) &s + sizeof(s)); ++ va_start(ap, s); ++ vsprintf(pars_errtxt, s, ap); ++ va_end(ap); + } + + |