9e8ecfb2f4
Some additional fixes from millert@ sprintf -> snprintf str{cat,cpy} -> strl{cat,cpy} http://marc.theaimsgroup.com/?l=bugtraq&m=105638591907836&w=2 ok naddy@
48 lines
1.3 KiB
Plaintext
48 lines
1.3 KiB
Plaintext
$OpenBSD: patch-gnats_getdate_c,v 1.1 2003/08/25 23:35:06 brad Exp $
|
|
--- gnats/getdate.c.orig Tue Feb 20 13:45:43 2001
|
|
+++ gnats/getdate.c Wed Jul 2 13:23:13 2003
|
|
@@ -51,6 +51,7 @@
|
|
#endif
|
|
|
|
#include <stdio.h>
|
|
+#include <stdlib.h>
|
|
#include <ctype.h>
|
|
|
|
#if defined (vms)
|
|
@@ -1225,6 +1226,7 @@ yyerrlab: /* here on detecting error *
|
|
{
|
|
int size = 0;
|
|
char *msg;
|
|
+ size_t msgsize;
|
|
int x, count;
|
|
|
|
count = 0;
|
|
@@ -1233,10 +1235,11 @@ yyerrlab: /* here on detecting error *
|
|
x < (sizeof(yytname) / sizeof(char *)); x++)
|
|
if (yycheck[x + yyn] == x)
|
|
size += strlen(yytname[x]) + 15, count++;
|
|
- msg = (char *) malloc(size + 15);
|
|
+ msgsize = size + 15;
|
|
+ msg = (char *) malloc(msgsize);
|
|
if (msg != 0)
|
|
{
|
|
- strcpy(msg, "parse error");
|
|
+ strlcpy(msg, "parse error", msgsize);
|
|
|
|
if (count < 5)
|
|
{
|
|
@@ -1245,9 +1248,10 @@ yyerrlab: /* here on detecting error *
|
|
x < (sizeof(yytname) / sizeof(char *)); x++)
|
|
if (yycheck[x + yyn] == x)
|
|
{
|
|
- strcat(msg, count == 0 ? ", expecting `" : " or `");
|
|
- strcat(msg, yytname[x]);
|
|
- strcat(msg, "'");
|
|
+ strlcat(msg, count == 0 ? ", expecting `" : " or `",
|
|
+ msgsize);
|
|
+ strlcat(msg, yytname[x], msgsize);
|
|
+ strlcat(msg, "'", msgsize);
|
|
count++;
|
|
}
|
|
}
|