summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2003-04-08 00:18:14 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2003-04-08 00:18:14 +0000
commitd5cf32b9a40c579557415b94415d349322b140b8 (patch)
tree6f84bdc7b04bf8f7b28b07bed4da9a98243b3e8c
parentf6b29b49c0f3c8936910f62561bd84f90e3bd3e3 (diff)
string cleaning; ok tedu
-rw-r--r--usr.bin/lex/misc.c7
-rw-r--r--usr.bin/yacc/reader.c8
-rw-r--r--usr.bin/yacc/symtab.c9
3 files changed, 11 insertions, 13 deletions
diff --git a/usr.bin/lex/misc.c b/usr.bin/lex/misc.c
index 2952b4c086d..39105e0441d 100644
--- a/usr.bin/lex/misc.c
+++ b/usr.bin/lex/misc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: misc.c,v 1.9 2002/05/31 22:49:29 deraadt Exp $ */
+/* $OpenBSD: misc.c,v 1.10 2003/04/08 00:18:13 deraadt Exp $ */
/* misc - miscellaneous flex routines */
@@ -28,7 +28,7 @@
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
-/* $Header: /cvs/OpenBSD/src/usr.bin/lex/misc.c,v 1.9 2002/05/31 22:49:29 deraadt Exp $ */
+/* $Header: /cvs/OpenBSD/src/usr.bin/lex/misc.c,v 1.10 2003/04/08 00:18:13 deraadt Exp $ */
#include "flexdef.h"
@@ -72,7 +72,8 @@ char *new_text;
reallocate_character_array( action_array, action_size );
}
- strcpy( &action_array[action_index], new_text );
+ strlcpy( &action_array[action_index], new_text,
+ action_size - action_index );
action_index += len;
}
diff --git a/usr.bin/yacc/reader.c b/usr.bin/yacc/reader.c
index 25eff52cca8..0424b1eef28 100644
--- a/usr.bin/yacc/reader.c
+++ b/usr.bin/yacc/reader.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: reader.c,v 1.12 2003/03/13 09:09:37 deraadt Exp $ */
+/* $OpenBSD: reader.c,v 1.13 2003/04/08 00:18:13 deraadt Exp $ */
/* $NetBSD: reader.c,v 1.5 1996/03/19 03:21:43 jtc Exp $ */
@@ -911,7 +911,7 @@ get_tag()
s = MALLOC(cinc);
if (s == 0) no_space();
- strcpy(s, cache);
+ strlcpy(s, cache, cinc);
tag_table[ntags] = s;
++ntags;
return (s);
@@ -1663,8 +1663,8 @@ pack_names()
name_pool = MALLOC(name_pool_size);
if (name_pool == 0) no_space();
- strcpy(name_pool, "$accept");
- strcpy(name_pool+8, "$end");
+ strlcpy(name_pool, "$accept", name_pool_size);
+ strlcpy(name_pool+8, "$end", name_pool_size - 8);
t = name_pool + 13;
for (bp = first_symbol; bp; bp = bp->next)
{
diff --git a/usr.bin/yacc/symtab.c b/usr.bin/yacc/symtab.c
index 9e500b81fe9..b17131c41a6 100644
--- a/usr.bin/yacc/symtab.c
+++ b/usr.bin/yacc/symtab.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: symtab.c,v 1.6 2002/02/16 21:28:00 millert Exp $ */
+/* $OpenBSD: symtab.c,v 1.7 2003/04/08 00:18:13 deraadt Exp $ */
/* $NetBSD: symtab.c,v 1.4 1996/03/19 03:21:48 jtc Exp $ */
/*
@@ -41,7 +41,7 @@
#if 0
static char sccsid[] = "@(#)symtab.c 5.3 (Berkeley) 6/1/90";
#else
-static char rcsid[] = "$OpenBSD: symtab.c,v 1.6 2002/02/16 21:28:00 millert Exp $";
+static char rcsid[] = "$OpenBSD: symtab.c,v 1.7 2003/04/08 00:18:13 deraadt Exp $";
#endif
#endif /* not lint */
@@ -88,7 +88,7 @@ char *name;
if (bp == 0) no_space();
bp->link = 0;
bp->next = 0;
- bp->name = MALLOC(strlen(name) + 1);
+ bp->name = strdup(name);
if (bp->name == 0) no_space();
bp->tag = 0;
bp->value = UNDEFINED;
@@ -97,9 +97,6 @@ char *name;
bp-> class = UNKNOWN;
bp->assoc = TOKEN;
- if (bp->name == 0) no_space();
- strcpy(bp->name, name);
-
return (bp);
}