use bounded string op
This commit is contained in:
parent
347022e133
commit
6d415bc4b0
@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: cdplay.c,v 1.25 2003/07/14 09:18:22 itojun Exp $ */
|
/* $NetBSD: cdplay.c,v 1.26 2003/07/14 11:55:56 itojun Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1999, 2000, 2001 Andrew Doran.
|
* Copyright (c) 1999, 2000, 2001 Andrew Doran.
|
||||||
@ -40,7 +40,7 @@
|
|||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
__RCSID("$NetBSD: cdplay.c,v 1.25 2003/07/14 09:18:22 itojun Exp $");
|
__RCSID("$NetBSD: cdplay.c,v 1.26 2003/07/14 11:55:56 itojun Exp $");
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
@ -211,7 +211,7 @@ main(int argc, char **argv)
|
|||||||
if (p > buf)
|
if (p > buf)
|
||||||
*p++ = ' ';
|
*p++ = ' ';
|
||||||
|
|
||||||
strcpy(p, *argv);
|
strlcpy(p, *argv, sizeof(buf) - (p - buf));
|
||||||
p += len;
|
p += len;
|
||||||
}
|
}
|
||||||
*p = '\0';
|
*p = '\0';
|
||||||
|
@ -44,7 +44,7 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 1993\n\
|
|||||||
#if 0
|
#if 0
|
||||||
static char sccsid[] = "from: @(#)fsplit.c 8.1 (Berkeley) 6/6/93";
|
static char sccsid[] = "from: @(#)fsplit.c 8.1 (Berkeley) 6/6/93";
|
||||||
#else
|
#else
|
||||||
__RCSID("$NetBSD: fsplit.c,v 1.8 2000/07/03 02:51:16 matt Exp $");
|
__RCSID("$NetBSD: fsplit.c,v 1.9 2003/07/14 11:59:07 itojun Exp $");
|
||||||
#endif
|
#endif
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
@ -95,7 +95,7 @@ int getline __P((void));
|
|||||||
void get_name __P((char *, int));
|
void get_name __P((char *, int));
|
||||||
int main __P((int, char **));
|
int main __P((int, char **));
|
||||||
int lend __P((void));
|
int lend __P((void));
|
||||||
int lname __P((char *));
|
int lname __P((char *, size_t));
|
||||||
char *look __P((char *, char *));
|
char *look __P((char *, char *));
|
||||||
int saveit __P((char *));
|
int saveit __P((char *));
|
||||||
int scan_name __P((char *, char *));
|
int scan_name __P((char *, char *));
|
||||||
@ -165,7 +165,7 @@ main(argc, argv)
|
|||||||
if (lend()) /* look for an 'end' statement */
|
if (lend()) /* look for an 'end' statement */
|
||||||
break;
|
break;
|
||||||
if (nflag == 0) /* if no name yet, try and find one */
|
if (nflag == 0) /* if no name yet, try and find one */
|
||||||
nflag = lname(name);
|
nflag = lname(name, sizeof(name));
|
||||||
}
|
}
|
||||||
fclose(ofp);
|
fclose(ofp);
|
||||||
if (rv == 0) { /* no lines in file, forget the file */
|
if (rv == 0) { /* no lines in file, forget the file */
|
||||||
@ -299,8 +299,9 @@ lend()
|
|||||||
block datas and main programs. */
|
block datas and main programs. */
|
||||||
|
|
||||||
int
|
int
|
||||||
lname(s)
|
lname(s, l)
|
||||||
char *s;
|
char *s;
|
||||||
|
size_t l;
|
||||||
{
|
{
|
||||||
# define LINESIZE 80
|
# define LINESIZE 80
|
||||||
char *ptr, *p;
|
char *ptr, *p;
|
||||||
@ -331,21 +332,21 @@ lname(s)
|
|||||||
(ptr = look(line, "function")) != 0 ||
|
(ptr = look(line, "function")) != 0 ||
|
||||||
(ptr = functs(line)) != 0) {
|
(ptr = functs(line)) != 0) {
|
||||||
if(scan_name(s, ptr)) return(1);
|
if(scan_name(s, ptr)) return(1);
|
||||||
strcpy( s, x);
|
strlcpy(s, x, l);
|
||||||
} else if((ptr = look(line, "program")) != 0) {
|
} else if((ptr = look(line, "program")) != 0) {
|
||||||
if(scan_name(s, ptr)) return(1);
|
if(scan_name(s, ptr)) return(1);
|
||||||
get_name( mainp, 4);
|
get_name(mainp, 4);
|
||||||
strcpy( s, mainp);
|
strlcpy(s, mainp, l);
|
||||||
} else if((ptr = look(line, "blockdata")) != 0) {
|
} else if((ptr = look(line, "blockdata")) != 0) {
|
||||||
if(scan_name(s, ptr)) return(1);
|
if(scan_name(s, ptr)) return(1);
|
||||||
get_name( blkp, 6);
|
get_name( blkp, 6);
|
||||||
strcpy( s, blkp);
|
strlcpy(s, blkp, l);
|
||||||
} else if((ptr = functs(line)) != 0) {
|
} else if((ptr = functs(line)) != 0) {
|
||||||
if(scan_name(s, ptr)) return(1);
|
if(scan_name(s, ptr)) return(1);
|
||||||
strcpy( s, x);
|
strlcpy(s, x, l);
|
||||||
} else {
|
} else {
|
||||||
get_name( mainp, 4);
|
get_name(mainp, 4);
|
||||||
strcpy( s, mainp);
|
strlcpy(s, mainp, l);
|
||||||
}
|
}
|
||||||
return(1);
|
return(1);
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: pwd_gensalt.c,v 1.9 2002/11/16 04:41:50 itojun Exp $ */
|
/* $NetBSD: pwd_gensalt.c,v 1.10 2003/07/14 11:54:06 itojun Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright 1997 Niels Provos <provos@physnet.uni-hamburg.de>
|
* Copyright 1997 Niels Provos <provos@physnet.uni-hamburg.de>
|
||||||
@ -34,7 +34,7 @@
|
|||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
__RCSID("$NetBSD: pwd_gensalt.c,v 1.9 2002/11/16 04:41:50 itojun Exp $");
|
__RCSID("$NetBSD: pwd_gensalt.c,v 1.10 2003/07/14 11:54:06 itojun Exp $");
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
#include <sys/syslimits.h>
|
#include <sys/syslimits.h>
|
||||||
@ -124,7 +124,7 @@ pwd_gensalt(char *salt, int max, struct passwd *pwd, char type)
|
|||||||
rounds = 4;
|
rounds = 4;
|
||||||
strlcpy(salt, bcrypt_gensalt(rounds), max);
|
strlcpy(salt, bcrypt_gensalt(rounds), max);
|
||||||
} else {
|
} else {
|
||||||
strcpy(salt, ":");
|
strlcpy(salt, ":", max);
|
||||||
warnx("Unknown option %s.", now);
|
warnx("Unknown option %s.", now);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user