diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2004-02-28 08:06:48 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2004-02-28 08:06:48 +0000 |
commit | daf28bb440e812ec8e982dc8405151d33e4a2390 (patch) | |
tree | 3e3ca7917a86d23e07e431c2e68c5519739b68fa /regress/lib | |
parent | e622817be818274084ff548fad943fd57055611c (diff) |
kill bad functions; some sort of ok from marc who is trying to confuse me
Diffstat (limited to 'regress/lib')
-rw-r--r-- | regress/lib/libc/regex/main.c | 6 | ||||
-rw-r--r-- | regress/lib/libc/regex/split.c | 8 | ||||
-rw-r--r-- | regress/lib/libpthread/pthread_join/pthread_join.c | 6 | ||||
-rw-r--r-- | regress/lib/libpthread/socket/2/socket2.c | 4 |
4 files changed, 12 insertions, 12 deletions
diff --git a/regress/lib/libc/regex/main.c b/regress/lib/libc/regex/main.c index 02f4bd7cf25..fd092905faf 100644 --- a/regress/lib/libc/regex/main.c +++ b/regress/lib/libc/regex/main.c @@ -1,4 +1,4 @@ -/* $OpenBSD: main.c,v 1.4 2003/07/31 21:48:03 deraadt Exp $ */ +/* $OpenBSD: main.c,v 1.5 2004/02/28 08:06:46 deraadt Exp $ */ /* $NetBSD: main.c,v 1.2 1995/04/20 22:39:51 cgd Exp $ */ #include <stdio.h> @@ -228,7 +228,7 @@ int opts; /* may not match f1 */ char f0copy[1000]; char f2copy[1000]; - strcpy(f0copy, f0); + strlcpy(f0copy, f0, sizeof f0copy); re.re_endp = (opts®_PEND) ? f0copy + strlen(f0copy) : NULL; fixstr(f0copy); err = regcomp(&re, f0copy, opts); @@ -252,7 +252,7 @@ int opts; /* may not match f1 */ return; } - strcpy(f2copy, f2); + strlcpy(f2copy, f2, sizeof f2copy); fixstr(f2copy); if (options('e', f1)®_STARTEND) { diff --git a/regress/lib/libc/regex/split.c b/regress/lib/libc/regex/split.c index 1e17a55b89e..f0f72c8b663 100644 --- a/regress/lib/libc/regex/split.c +++ b/regress/lib/libc/regex/split.c @@ -1,4 +1,4 @@ -/* $OpenBSD: split.c,v 1.3 2003/07/31 21:48:03 deraadt Exp $ */ +/* $OpenBSD: split.c,v 1.4 2004/02/28 08:06:47 deraadt Exp $ */ /* $NetBSD: split.c,v 1.2 1995/04/20 22:39:57 cgd Exp $ */ #include <stdio.h> @@ -160,11 +160,11 @@ char *argv[]; if (argc > 4) for (n = atoi(argv[3]); n > 0; n--) { - (void) strcpy(buf, argv[1]); + (void) strlcpy(buf, argv[1], sizeof buf); } else if (argc > 3) for (n = atoi(argv[3]); n > 0; n--) { - (void) strcpy(buf, argv[1]); + (void) strlcpy(buf, argv[1], sizeof buf); (void) split(buf, fields, MNF, argv[2]); } else if (argc > 2) @@ -286,7 +286,7 @@ regress() register char *f; for (n = 0; tests[n].str != NULL; n++) { - (void) strcpy(buf, tests[n].str); + (void) strlcpy(buf, tests[n].str, sizeof buf); fields[RNF] = NULL; nf = split(buf, fields, RNF, tests[n].seps); printit = 0; diff --git a/regress/lib/libpthread/pthread_join/pthread_join.c b/regress/lib/libpthread/pthread_join/pthread_join.c index e77a1a0bce4..b0b60ad3e9e 100644 --- a/regress/lib/libpthread/pthread_join/pthread_join.c +++ b/regress/lib/libpthread/pthread_join/pthread_join.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pthread_join.c,v 1.3 2003/07/31 21:48:05 deraadt Exp $ */ +/* $OpenBSD: pthread_join.c,v 1.4 2004/02/28 08:06:47 deraadt Exp $ */ /* * Copyright (c) 1993, 1994, 1995, 1996 by Chris Provenzano and contributors, * proven@mit.edu All rights reserved. @@ -53,7 +53,7 @@ new_thread_1(void * new_buf) { int i; - sprintf((char *)new_buf, "New thread %%d stack at %p\n", &i); + snprintf((char *)new_buf, 512, "New thread %%d stack at %p\n", &i); pthread_yield(); /* (ensure parent can wait on live thread) */ sleep(1); return(new_buf); @@ -66,7 +66,7 @@ new_thread_2(void * new_buf) { int i; - sprintf((char *)new_buf, "New thread %%d stack at %p\n", &i); + snprintf((char *)new_buf, 512, "New thread %%d stack at %p\n", &i); return(new_buf); PANIC("return"); } diff --git a/regress/lib/libpthread/socket/2/socket2.c b/regress/lib/libpthread/socket/2/socket2.c index 843d8d2f851..5b53937662b 100644 --- a/regress/lib/libpthread/socket/2/socket2.c +++ b/regress/lib/libpthread/socket/2/socket2.c @@ -1,4 +1,4 @@ -/* $OpenBSD: socket2.c,v 1.4 2003/07/31 21:48:06 deraadt Exp $ */ +/* $OpenBSD: socket2.c,v 1.5 2004/02/28 08:06:47 deraadt Exp $ */ /* * Copyright (c) 1993, 1994, 1995, 1996 by Chris Provenzano and contributors, * proven@mit.edu All rights reserved. @@ -125,7 +125,7 @@ sock_accept(void *arg) CHECKr(pthread_mutex_lock(&waiter_mutex)); CHECKr(pthread_create(&wthread, NULL, waiter, NULL)); - sprintf(buf, "%d", port); + snprintf(buf, sizeof buf, "%d", port); CHECKe(pid = fork()); switch(pid) { |