use bounded string op
This commit is contained in:
parent
02af72a142
commit
2fe0488981
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: mkstr.c,v 1.9 2000/10/11 14:46:13 is Exp $ */
|
||||
/* $NetBSD: mkstr.c,v 1.10 2003/07/14 09:35:52 itojun Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980, 1993
|
||||
@ -43,7 +43,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 1993\n\
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)mkstr.c 8.1 (Berkeley) 6/6/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: mkstr.c,v 1.9 2000/10/11 14:46:13 is Exp $");
|
||||
__RCSID("$NetBSD: mkstr.c,v 1.10 2003/07/14 09:35:52 itojun Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@ -114,11 +114,11 @@ main(argc, argv)
|
||||
perror(argv[0]), exit(1);
|
||||
inithash();
|
||||
argc--, argv++;
|
||||
strcpy(name, argv[0]);
|
||||
strlcpy(name, argv[0], sizeof(name));
|
||||
np = name + strlen(name);
|
||||
argc--, argv++;
|
||||
do {
|
||||
strcpy(np, argv[0]);
|
||||
strlcpy(np, argv[0], sizeof(name) - (np - name));
|
||||
if (freopen(name, "w", stdout) == NULL)
|
||||
perror(name), exit(1);
|
||||
if (freopen(argv[0], "r", stdin) == NULL)
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: defs.h,v 1.2 2002/01/29 10:20:35 tv Exp $ */
|
||||
/* $NetBSD: defs.h,v 1.3 2003/07/14 09:34:00 itojun Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright 1997 Piermont Information Systems Inc.
|
||||
@ -73,24 +73,23 @@ EXTERN id_rec *root INIT(NULL);
|
||||
/* Prototypes. */
|
||||
|
||||
/* From util.c */
|
||||
void yyerror (const char *, ...);
|
||||
void buff_add_ch (char);
|
||||
char *buff_copy (void);
|
||||
void yyerror(const char *, ...);
|
||||
void buff_add_ch(char);
|
||||
char *buff_copy(void);
|
||||
|
||||
/* From avl.c */
|
||||
id_rec *find_id (id_rec *tree, char *id);
|
||||
int insert_id (id_rec **root, id_rec *new_id);
|
||||
id_rec *find_id(id_rec *, char *);
|
||||
int insert_id(id_rec **, id_rec *);
|
||||
|
||||
/* from scan.l */
|
||||
int yylex (void);
|
||||
int yylex(void);
|
||||
|
||||
/* from parse.y */
|
||||
int yyparse (void);
|
||||
int yyparse(void);
|
||||
|
||||
/* Vars not defined in main.c */
|
||||
extern FILE *yyin;
|
||||
|
||||
/* from mdb.c */
|
||||
void define_msg (char *, char *);
|
||||
void write_msg_file (void);
|
||||
|
||||
void define_msg(char *, char *);
|
||||
void write_msg_file(void);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: msg_sys.def,v 1.22 2003/07/07 12:22:35 dsl Exp $ */
|
||||
/* $NetBSD: msg_sys.def,v 1.23 2003/07/14 09:34:01 itojun Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright 1997 Piermont Information Systems Inc.
|
||||
@ -386,7 +386,7 @@ _msg_vprompt(const char *msg, int do_echo, const char *def, char *val,
|
||||
/* copy the appropriate string to the output */
|
||||
if (count != 0) {
|
||||
ibuf[count] = '\0';
|
||||
strcpy(val, ibuf); /* size known to be OK */
|
||||
strlcpy(val, ibuf, max_chars);
|
||||
} else if (def != NULL && val != def) {
|
||||
strlcpy(val, def, max_chars);
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: pwhash.c,v 1.4 2003/06/23 13:05:51 agc Exp $ */
|
||||
/* $NetBSD: pwhash.c,v 1.5 2003/07/14 09:33:08 itojun Exp $ */
|
||||
/* $OpenBSD: encrypt.c,v 1.16 2002/02/16 21:27:45 millert Exp $ */
|
||||
|
||||
/*
|
||||
@ -28,7 +28,7 @@
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
#ifndef lint
|
||||
__RCSID("$NetBSD: pwhash.c,v 1.4 2003/06/23 13:05:51 agc Exp $");
|
||||
__RCSID("$NetBSD: pwhash.c,v 1.5 2003/07/14 09:33:08 itojun Exp $");
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
@ -100,15 +100,15 @@ print_passwd(char *string, int operation, void *extra)
|
||||
/* To be compatible... */
|
||||
errx(1, "%s", strerror(EFTYPE));
|
||||
}
|
||||
strcpy(msalt, &string[8]);
|
||||
strlcpy(msalt, &string[8], sizeof(msalt));
|
||||
salt = msalt;
|
||||
break;
|
||||
|
||||
case DO_MD5:
|
||||
strcpy(buffer, "$1$");
|
||||
strlcpy(buffer, "$1$", sizeof(buffer));
|
||||
to64(&buffer[3], arc4random(), 4);
|
||||
to64(&buffer[7], arc4random(), 4);
|
||||
strcpy(buffer + 11, "$");
|
||||
strlcpy(buffer + 11, "$", sizeof(buffer) - 11);
|
||||
salt = buffer;
|
||||
break;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user