aports/main/sc/format-security.patch
2023-04-20 01:59:22 +02:00

49 lines
1.5 KiB
Diff

diff --git a/vmtbl.c b/vmtbl.c
index 8fb6b90..09f4dc4 100644
--- a/vmtbl.c
+++ b/vmtbl.c
@@ -18,6 +18,8 @@
#include "sc.h"
+#define error(fmt, ...) printf(fmt, __VA_ARGS__)
+
/*
* check to see if *rowp && *colp are currently allocated, if not expand the
* current size if we can.
@@ -55,7 +57,7 @@ checkbounds(int *rowp, int *colp)
newptr = (type *)scxrealloc((char *)oldptr, \
(unsigned)(nelem * sizeof(type))); \
if (newptr == (type *)NULL) { \
- error(msg); \
+ error("%s", msg); \
return (FALSE); \
} \
oldptr = newptr /* wait incase we can't alloc */
@@ -117,7 +119,7 @@ growtbl(int rowcol, int toprow, int topcol)
if ((rowcol == GROWCOL) || (rowcol == GROWBOTH)) {
if ((rowcol == GROWCOL) && ((maxcols == ABSMAXCOLS) ||
(topcol >= ABSMAXCOLS))) {
- error(nowider);
+ error("%s", nowider);
return (FALSE);
}
@@ -172,7 +174,7 @@ growtbl(int rowcol, int toprow, int topcol)
for (i = 0; i < maxrows; i++) {
if ((tbl[i] = (struct ent **)scxrealloc((char *)tbl[i],
(unsigned)(newcols * sizeof(struct ent **)))) == (struct ent **)0) {
- error(nowider);
+ error("%s", nowider);
return(FALSE);
}
for (nullit = ATBL(tbl, i, maxcols), cnt = 0;
@@ -190,7 +192,7 @@ growtbl(int rowcol, int toprow, int topcol)
for (; i < newrows; i++) {
if ((tbl[i] = (struct ent **)scxmalloc((unsigned)(newcols *
sizeof(struct ent **)))) == (struct ent **)0) {
- error(nowider);
+ error("%s", nowider);
return(FALSE);
}
for (nullit = tbl[i], cnt = 0; cnt < newcols; cnt++, nullit++)