89 lines
2.9 KiB
Plaintext
89 lines
2.9 KiB
Plaintext
$OpenBSD: patch-lib_cconv_c,v 1.2 2012/03/17 23:01:09 naddy Exp $
|
||
--- lib/cconv.c.orig Wed May 26 17:55:25 1999
|
||
+++ lib/cconv.c Sat Mar 17 16:58:01 2012
|
||
@@ -611,7 +611,7 @@ static char *rcsid = "$Id: cconv.c,v 10.8 1999/05/07 0
|
||
|
||
#define EPROC2(efunc, format, a) { \
|
||
char tmp[1024]; \
|
||
- (void)sprintf(tmp, format, a); \
|
||
+ (void)snprintf(tmp, sizeof(tmp), format, a); \
|
||
eproc(efunc, tmp); }
|
||
|
||
/* $B%-!<%3!<%I$N%(%s%3!<%IJ}K!(B */
|
||
@@ -767,7 +767,7 @@ static wchar *promptsave(wchar *);
|
||
static int parseLine(uchar *, uchar **, int);
|
||
static FILE *openfile(char *);
|
||
static int doinclude(uchar *, Files *, void (*)());
|
||
-static uchar *getline(uchar *, int, Files *, void (*)());
|
||
+static uchar *get_line(uchar *, int, Files *, void (*)());
|
||
static int readRuleFile(ccRule, char *);
|
||
static int registMode(ccRule, int, uchar **);
|
||
static int newMode(ccRule, Files *, _strbufRec *, _funcbufRec *,
|
||
@@ -965,7 +965,7 @@ char *file;
|
||
if (q == filename) continue;
|
||
*q++ = '/';
|
||
*q = '\0';
|
||
- (void)Strcat(filename, file);
|
||
+ (void)strlcat(filename, file, sizeof(filename));
|
||
if ((fp = fopen(filename, "r")) != NULL)
|
||
return fp;
|
||
}
|
||
@@ -973,8 +973,8 @@ char *file;
|
||
/* $B%G%U%)%k%H$N%5!<%A%Q%9(B CCDEFPATH(/usr/lib/X11/ccdef) $B$N(B
|
||
* $B2<$r%5!<%A$9$k(B
|
||
*/
|
||
- (void)Strcpy(filename, CCDEFPATH);
|
||
- (void)Strcat(filename, file);
|
||
+ (void)strlcpy(filename, (char *)CCDEFPATH, sizeof(filename));
|
||
+ (void)strlcat(filename, file, sizeof(filename));
|
||
fp = fopen(filename, "r");
|
||
}
|
||
return fp;
|
||
@@ -1013,7 +1013,7 @@ void (*efunc)();
|
||
}
|
||
|
||
/* getline -- 1$B9TFI$_9~$`(B ($B$=$N:](B include $B$N=hM}$r9T$J$&(B) */
|
||
-static uchar *getline(line, linesize, files, efunc)
|
||
+static uchar *get_line(line, linesize, files, efunc)
|
||
uchar *line;
|
||
int linesize;
|
||
Files *files;
|
||
@@ -1077,8 +1077,8 @@ char *file;
|
||
rule->nmode = 0;
|
||
rule->initialmode = -1;
|
||
|
||
- while (getline(line, sizeof(line), &files, efunc)) {
|
||
- (void)Strcpy(tmp, line);
|
||
+ while (get_line(line, sizeof(line), &files, efunc)) {
|
||
+ (void)strlcpy(tmp, line, sizeof(tmp));
|
||
if ((argc = parseLine(tmp, argv, 20)) == 0)
|
||
continue;
|
||
|
||
@@ -1246,7 +1246,7 @@ uchar **av;
|
||
cdbuf.cdbuf = NULL;
|
||
|
||
/* $B%k!<%k$rFI$s$G%9%H%"$9$k(B */
|
||
- while (getline(line, sizeof(line), files, efunc)) {
|
||
+ while (get_line(line, sizeof(line), files, efunc)) {
|
||
/* '#' $B$G;O$^$k9T$O%3%a%s%H(B */
|
||
if (*line == '\0' || *line == '\n' || *line == '#')
|
||
continue;
|
||
@@ -1302,7 +1302,7 @@ int *funcp;
|
||
"context" key "result" [function...]
|
||
*/
|
||
|
||
- (void)Strcpy(tmp, line);
|
||
+ (void)strlcpy(tmp, line, sizeof(tmp));
|
||
ac = parseLine(tmp, av, 20);
|
||
if (ac < 3) {
|
||
EPROC2(efunc, "syntax error - %s", line);
|
||
@@ -1885,7 +1885,7 @@ char *funcname;
|
||
fnrec->funcnameend = cp + size;
|
||
}
|
||
|
||
- (void)strcpy(fnrec->funcnamep, funcname);
|
||
+ (void)strlcpy(fnrec->funcnamep, funcname, MOREFUNCNAMESIZE);
|
||
fnrec->funcnames[nfunc] = fnrec->funcnamep - fnrec->funcnamebuf;
|
||
fnrec->funcnamep += len;
|
||
|