summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Scherer <misc@mandriva.org>2010-03-07 19:29:39 -0500
committerSadrul Habib Chowdhury <sadrul@users.sourceforge.net>2010-03-07 19:29:39 -0500
commit261a022ce947d17471b73a71345c265df9bfe7a4 (patch)
treea527b05c46c7f5b91ef7413f75627d71f7fd5f80
parent2e62d3683eefb23e6955b55c16ce3266b12aa401 (diff)
downloadscreen-261a022ce947d17471b73a71345c265df9bfe7a4.tar.gz
Fix build with -Werror=format-security
Some distributions ( mandriva for example ) use -Werror=format-security by default when build C software to try to enhance code quality and prevent security bugs. As the policy is to correct all occurences of the error ( so there is no false positive, nor question about to fix it or not ), a patch that fix the error on gnu screen 4.0.3 have been added to the package. I have rediffed it against latest git snapshot, to be sent upstream. It mainly add "%s" where applicable.
-rw-r--r--src/attacher.c2
-rw-r--r--src/fileio.c8
-rw-r--r--src/misc.c4
-rw-r--r--src/process.c16
-rw-r--r--src/resize.c6
-rw-r--r--src/screen.c6
-rw-r--r--src/socket.c2
-rw-r--r--src/termcap.c8
-rw-r--r--src/window.c6
9 files changed, 29 insertions, 29 deletions
diff --git a/src/attacher.c b/src/attacher.c
index 88da744..370d594 100644
--- a/src/attacher.c
+++ b/src/attacher.c
@@ -756,7 +756,7 @@ LockTerminal()
debug2("Lock: %s: return code %d\n", prg, WEXITSTATUS(wstat));
}
else
- printf(LockEnd);
+ printf("%s", LockEnd);
}
}
else
diff --git a/src/fileio.c b/src/fileio.c
index b889df6..88fbf64 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -75,7 +75,7 @@ register char *str1, *str2;
{
len2 = strlen(str2);
if ((cp = realloc(str2, (unsigned) len1 + len2 + add_colon + 1)) == NULL)
- Panic(0, strnomem);
+ Panic(0, "%s", strnomem);
bcopy(cp, cp + len1 + add_colon, len2 + 1);
}
else
@@ -83,8 +83,8 @@ register char *str1, *str2;
if (len1 == 0)
return 0;
if ((cp = malloc((unsigned) len1 + add_colon + 1)) == NULL)
- Panic(0, strnomem);
- cp[len1 + add_colon] = '\0';
+ Panic(0, "%s", strnomem);
+ cp[len1 + add_colon] = '\0';
}
bcopy(str1, cp, len1);
if (add_colon)
@@ -627,7 +627,7 @@ int *lenp;
if ((buf = malloc(size)) == NULL)
{
close(i);
- Msg(0, strnomem);
+ Msg(0, "%s", strnomem);
return NULL;
}
errno = 0;
diff --git a/src/misc.c b/src/misc.c
index 7bc06f6..ff3bebb 100644
--- a/src/misc.c
+++ b/src/misc.c
@@ -57,7 +57,7 @@ register const char *str;
register char *cp;
if ((cp = malloc(strlen(str) + 1)) == NULL)
- Panic(0, strnomem);
+ Panic(0, "%s", strnomem);
else
strcpy(cp, str);
return cp;
@@ -71,7 +71,7 @@ int n;
register char *cp;
if ((cp = malloc(n + 1)) == NULL)
- Panic(0, strnomem);
+ Panic(0, "%s", strnomem);
else
{
bcopy((char *)str, cp, n);
diff --git a/src/process.c b/src/process.c
index 137037d..d685501 100644
--- a/src/process.c
+++ b/src/process.c
@@ -691,7 +691,7 @@ int create;
kp = malloc(sizeof(*kp));
if (kp == 0)
{
- Msg(0, strnomem);
+ Msg(0, "%s", strnomem);
return 0;
}
kp->name = SaveStr(class);
@@ -2380,7 +2380,7 @@ int key;
*/
if ((dbuf = (char *)malloc(l)) == 0)
{
- Msg(0, strnomem);
+ Msg(0, "%s", strnomem);
break;
}
l = 0;
@@ -2467,7 +2467,7 @@ int key;
newbuf = malloc(l + 1);
if (!newbuf)
{
- Msg(0, strnomem);
+ Msg(0, "%s", strnomem);
break;
}
user->u_plop.len = RecodeBuf((unsigned char *)oldplop.buf, oldplop.len, oldplop.enc, enc, (unsigned char *)newbuf);
@@ -4501,9 +4501,9 @@ int *argl;
return;
}
if ((pp = (char **)malloc((unsigned)(argc + 1) * sizeof(char **))) == 0)
- Panic(0, strnomem);
+ Panic(0, "%s", strnomem);
if ((lp = (int *)malloc((unsigned)(argc) * sizeof(int *))) == 0)
- Panic(0, strnomem);
+ Panic(0, "%s", strnomem);
act->nr = nr;
act->args = pp;
act->argl = lp;
@@ -4525,7 +4525,7 @@ char **args;
while (args[argc])
argc++;
if ((pp = ap = (char **)malloc((unsigned)(argc + 1) * sizeof(char **))) == 0)
- Panic(0, strnomem);
+ Panic(0, "%s", strnomem);
while (argc--)
*pp++ = SaveStr(*args++);
*pp = 0;
@@ -6074,7 +6074,7 @@ char *data; /* dummy */
{
if ((pp->buf = (char *)malloc(D_user->u_plop.len)) == NULL)
{
- Msg(0, strnomem);
+ Msg(0, "%s", strnomem);
return;
}
bcopy(D_user->u_plop.buf, pp->buf, D_user->u_plop.len);
@@ -6281,7 +6281,7 @@ char *data;
#endif
if (!(u->u_plop.buf = SaveStr(u->u_password)))
{
- Msg(0, strnomem);
+ Msg(0, "%s", strnomem);
D_user->u_plop.len = 0;
}
else
diff --git a/src/resize.c b/src/resize.c
index 39f6e28..10dfd8e 100644
--- a/src/resize.c
+++ b/src/resize.c
@@ -521,7 +521,7 @@ int wi;
# endif
#endif
if (!(blank && null && mline_old.image && mline_old.attr IFFONT(&& mline_old.font) IFCOLOR(&& mline_old.color) IFCOLORX(&& mline_old.colorx)))
- Panic(0, strnomem);
+ Panic(0, "%s", strnomem);
MakeBlankLine(blank, maxwidth);
bzero((char *)null, maxwidth);
@@ -691,7 +691,7 @@ int wi, he, hi;
if ((nmlines = (struct mline *)calloc(he, sizeof(struct mline))) == 0)
{
KillWindow(p);
- Msg(0, strnomem);
+ Msg(0, "%s", strnomem);
return -1;
}
}
@@ -924,7 +924,7 @@ int wi, he, hi;
#endif
}
KillWindow(p);
- Msg(0, strnomem);
+ Msg(0, "%s", strnomem);
return -1;
}
for (; t < wi; t++)
diff --git a/src/screen.c b/src/screen.c
index 06441dd..e26e4b8 100644
--- a/src/screen.c
+++ b/src/screen.c
@@ -2052,7 +2052,7 @@ MakeNewEnv()
free((char *)NewEnv);
NewEnv = np = (char **) malloc((unsigned) (op - environ + 7 + 1) * sizeof(char **));
if (!NewEnv)
- Panic(0, strnomem);
+ Panic(0, "%s", strnomem);
sprintf(stybuf, "STY=%s", strlen(SockName) <= MAXSTR - 5 ? SockName : "?");
*np++ = stybuf; /* NewEnv[0] */
*np++ = Term; /* NewEnv[1] */
@@ -2389,7 +2389,7 @@ char **cmdv;
bt = (struct backtick *)malloc(sizeof *bt);
if (!bt)
{
- Msg(0, strnomem);
+ Msg(0, "%s", strnomem);
return;
}
bzero(bt, sizeof(*bt));
@@ -2411,7 +2411,7 @@ char **cmdv;
bt->buf = (char *)malloc(MAXSTR);
if (bt->buf == 0)
{
- Msg(0, strnomem);
+ Msg(0, "%s", strnomem);
setbacktick(num, 0, 0, (char **)0);
return;
}
diff --git a/src/socket.c b/src/socket.c
index 9e61816..9dbf461 100644
--- a/src/socket.c
+++ b/src/socket.c
@@ -1540,7 +1540,7 @@ struct msg *m;
ASSERT(display);
pwdata = (struct pwdata *)malloc(sizeof(struct pwdata));
if (!pwdata)
- Panic(0, strnomem);
+ Panic(0, "%s", strnomem);
pwdata->l = 0;
pwdata->m = *m;
D_processinputdata = (char *)pwdata;
diff --git a/src/termcap.c b/src/termcap.c
index 8f6b8b9..32ae63d 100644
--- a/src/termcap.c
+++ b/src/termcap.c
@@ -137,7 +137,7 @@ int he;
if ((D_tentry = (char *)malloc(TERMCAP_BUFSIZE + (extra_incap ? strlen(extra_incap) + 1 : 0))) == 0)
{
- Msg(0, strnomem);
+ Msg(0, "%s", strnomem);
return -1;
}
@@ -1198,7 +1198,7 @@ char *s;
if ((D_xtable = (char ***)calloc(256, sizeof(char **))) == 0)
{
- Msg(0, strnomem);
+ Msg(0, "%s", strnomem);
return -1;
}
@@ -1216,7 +1216,7 @@ char *s;
{
if ((D_xtable[curchar] = (char **)calloc(257, sizeof(char *))) == 0)
{
- Msg(0, strnomem);
+ Msg(0, "%s", strnomem);
FreeTransTable();
return -1;
}
@@ -1250,7 +1250,7 @@ char *s;
l = l * templnsub + templlen;
if ((ctable[c] = (char *)malloc(l + 1)) == 0)
{
- Msg(0, strnomem);
+ Msg(0, "%s", strnomem);
FreeTransTable();
return -1;
}
diff --git a/src/window.c b/src/window.c
index 99e0bc7..a800d4a 100644
--- a/src/window.c
+++ b/src/window.c
@@ -613,7 +613,7 @@ struct NewWindow *newwin;
if ((p = (struct win *)calloc(1, sizeof(struct win))) == 0)
{
close(f);
- Msg(0, strnomem);
+ Msg(0, "%s", strnomem);
return -1;
}
@@ -649,7 +649,7 @@ struct NewWindow *newwin;
{
free((char *)p);
close(f);
- Msg(0, strnomem);
+ Msg(0, "%s", strnomem);
return -1;
}
#endif
@@ -1530,7 +1530,7 @@ char **av;
}
if (!(pwin = (struct pseudowin *)calloc(1, sizeof(struct pseudowin))))
{
- Msg(0, strnomem);
+ Msg(0, "%s", strnomem);
return -1;
}