diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libc/net/getnetnamadr.c | 7 | ||||
-rw-r--r-- | lib/libc/regex/regcomp.c | 5 | ||||
-rw-r--r-- | lib/libc/time/zdump.c | 6 | ||||
-rw-r--r-- | lib/libedit/history.c | 8 | ||||
-rw-r--r-- | lib/libedit/term.c | 12 | ||||
-rw-r--r-- | lib/libwrap/options.c | 6 |
6 files changed, 23 insertions, 21 deletions
diff --git a/lib/libc/net/getnetnamadr.c b/lib/libc/net/getnetnamadr.c index 75a75243efd..1be874209f2 100644 --- a/lib/libc/net/getnetnamadr.c +++ b/lib/libc/net/getnetnamadr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: getnetnamadr.c,v 1.20 2003/01/28 04:58:00 marc Exp $ */ +/* $OpenBSD: getnetnamadr.c,v 1.21 2003/04/05 00:43:19 tdeval Exp $ */ /* * Copyright (c) 1997, Jason Downs. All rights reserved. @@ -77,7 +77,7 @@ static char sccsid[] = "@(#)getnetbyaddr.c 8.1 (Berkeley) 6/4/93"; static char sccsid_[] = "from getnetnamadr.c 1.4 (Coimbra) 93/06/03"; static char rcsid[] = "$From: getnetnamadr.c,v 8.7 1996/08/05 08:31:35 vixie Exp $"; #else -static char rcsid[] = "$OpenBSD: getnetnamadr.c,v 1.20 2003/01/28 04:58:00 marc Exp $"; +static char rcsid[] = "$OpenBSD: getnetnamadr.c,v 1.21 2003/04/05 00:43:19 tdeval Exp $"; #endif #endif /* LIBC_SCCS and not lint */ @@ -242,8 +242,9 @@ getnetanswer(answer, anslen, net_i) if (i != 0) nchar++; strlcpy(paux1, in, nchar+1); + strlcat(paux1, paux2, MAXHOSTNAMELEN); pauxt = paux2; - paux2 = strcat(paux1, paux2); + paux2 = paux1; paux1 = pauxt; in = ++st; } diff --git a/lib/libc/regex/regcomp.c b/lib/libc/regex/regcomp.c index 10224be9240..fc01ad0bb4b 100644 --- a/lib/libc/regex/regcomp.c +++ b/lib/libc/regex/regcomp.c @@ -41,7 +41,7 @@ #if 0 static char sccsid[] = "@(#)regcomp.c 8.5 (Berkeley) 3/20/94"; #else -static char rcsid[] = "$OpenBSD: regcomp.c,v 1.8 2002/02/16 21:27:24 millert Exp $"; +static char rcsid[] = "$OpenBSD: regcomp.c,v 1.9 2003/04/05 00:43:20 tdeval Exp $"; #endif #endif /* LIBC_SCCS and not lint */ @@ -1285,8 +1285,7 @@ register char *cp; } cs->multis = np; - (void) strcpy(cs->multis + oldend - 1, cp); - cs->multis[cs->smultis - 1] = '\0'; + strlcpy(cs->multis + oldend - 1, cp, cs->smultis - oldend + 1); } /* diff --git a/lib/libc/time/zdump.c b/lib/libc/time/zdump.c index 5b902cf5607..dd3f71b8e77 100644 --- a/lib/libc/time/zdump.c +++ b/lib/libc/time/zdump.c @@ -5,7 +5,7 @@ #if defined(LIBC_SCCS) && !defined(lint) && !defined(NOID) static char elsieid[] = "@(#)zdump.c 7.29"; -static char rcsid[] = "$OpenBSD: zdump.c,v 1.10 2003/02/14 18:24:53 millert Exp $"; +static char rcsid[] = "$OpenBSD: zdump.c,v 1.11 2003/04/05 00:43:20 tdeval Exp $"; #endif /* LIBC_SCCS and not lint */ /* @@ -209,7 +209,7 @@ _("%s: usage is %s [ -v ] [ -c cutoff ] zonename ...\n"), (void) exit(EXIT_FAILURE); } to = 0; - (void) strcpy(fakeenv[to++], "TZ="); + strlcpy(fakeenv[to++], "TZ=", longest + 4); for (from = 0; environ[from] != NULL; ++from) if (strncmp(environ[from], "TZ=", 3) != 0) fakeenv[to++] = environ[from]; @@ -219,7 +219,7 @@ _("%s: usage is %s [ -v ] [ -c cutoff ] zonename ...\n"), for (i = optind; i < argc; ++i) { static char buf[MAX_STRING_LENGTH]; - (void) strcpy(&fakeenv[0][3], argv[i]); + strlcpy(&fakeenv[0][3], argv[i], longest + 1); if (!vflag) { show(argv[i], now, FALSE); continue; diff --git a/lib/libedit/history.c b/lib/libedit/history.c index d6b9e745662..7ba8f0897b4 100644 --- a/lib/libedit/history.c +++ b/lib/libedit/history.c @@ -1,4 +1,4 @@ -/* $OpenBSD: history.c,v 1.7 2002/02/19 19:39:37 millert Exp $ */ +/* $OpenBSD: history.c,v 1.8 2003/04/05 00:43:20 tdeval Exp $ */ /* $NetBSD: history.c,v 1.5 1997/04/11 17:52:46 christos Exp $ */ /*- @@ -41,7 +41,7 @@ #if 0 static char sccsid[] = "@(#)history.c 8.1 (Berkeley) 6/4/93"; #else -static char rcsid[] = "$OpenBSD: history.c,v 1.7 2002/02/19 19:39:37 millert Exp $"; +static char rcsid[] = "$OpenBSD: history.c,v 1.8 2003/04/05 00:43:20 tdeval Exp $"; #endif #endif /* not lint && not SCCSID */ @@ -234,8 +234,8 @@ history_def_add(p, str) return (history_def_enter(p, str)); len = strlen(h->cursor->ev.str) + strlen(str) + 1; s = (char *) h_malloc(len); - (void)strcpy(s, h->cursor->ev.str); - (void)strcat(s, str); + (void)strlcpy(s, h->cursor->ev.str, len); + (void)strlcat(s, str, len); h_free((ptr_t) h->cursor->ev.str); h->cursor->ev.str = s; return &h->cursor->ev; diff --git a/lib/libedit/term.c b/lib/libedit/term.c index c516b8a3013..c69d2b5a1df 100644 --- a/lib/libedit/term.c +++ b/lib/libedit/term.c @@ -1,4 +1,4 @@ -/* $OpenBSD: term.c,v 1.7 2002/11/29 20:13:39 deraadt Exp $ */ +/* $OpenBSD: term.c,v 1.8 2003/04/05 00:43:20 tdeval Exp $ */ /* $NetBSD: term.c,v 1.8 1997/01/23 14:02:49 mrg Exp $ */ /*- @@ -41,7 +41,7 @@ #if 0 static char sccsid[] = "@(#)term.c 8.1 (Berkeley) 6/4/93"; #else -static char rcsid[] = "$OpenBSD: term.c,v 1.7 2002/11/29 20:13:39 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: term.c,v 1.8 2003/04/05 00:43:20 tdeval Exp $"; #endif #endif /* not lint && not SCCSID */ @@ -371,7 +371,7 @@ term_alloc(el, t, cap) * New string is shorter; no need to allocate space */ if (clen <= tlen) { - (void)strcpy(*str, cap); + (void)strlcpy(*str, cap, tlen + 1); return; } @@ -379,7 +379,8 @@ term_alloc(el, t, cap) * New string is longer; see if we have enough space to append */ if (el->el_term.t_loc + 3 < TC_BUFSIZE) { - (void)strcpy(*str = &el->el_term.t_buf[el->el_term.t_loc], cap); + tlen = TC_BUFSIZE - el->el_term.t_loc; + (void)strlcpy(*str = &el->el_term.t_buf[el->el_term.t_loc], cap, tlen); el->el_term.t_loc += clen + 1; /* one for \0 */ return; } @@ -403,7 +404,8 @@ term_alloc(el, t, cap) (void)fprintf(el->el_errfile, "Out of termcap string space.\n"); return; } - (void)strcpy(*str = &el->el_term.t_buf[el->el_term.t_loc], cap); + tlen = TC_BUFSIZE - el->el_term.t_loc; + (void)strlcpy(*str = &el->el_term.t_buf[el->el_term.t_loc], cap, tlen); el->el_term.t_loc += clen + 1; /* one for \0 */ return; } /* end term_alloc */ diff --git a/lib/libwrap/options.c b/lib/libwrap/options.c index fe624844996..ee2cbfd778f 100644 --- a/lib/libwrap/options.c +++ b/lib/libwrap/options.c @@ -1,4 +1,4 @@ -/* $OpenBSD: options.c,v 1.4 2002/06/07 00:04:21 itojun Exp $ */ +/* $OpenBSD: options.c,v 1.5 2003/04/05 00:43:20 tdeval Exp $ */ /* * General skeleton for adding options to the access control language. The @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#) options.c 1.17 96/02/11 17:01:31"; #else -static char rcsid[] = "$OpenBSD: options.c,v 1.4 2002/06/07 00:04:21 itojun Exp $"; +static char rcsid[] = "$OpenBSD: options.c,v 1.5 2003/04/05 00:43:20 tdeval Exp $"; #endif #endif @@ -254,7 +254,7 @@ struct request_info *request; ungetc(ch, fp); while (fgets(ibuf, sizeof(ibuf) - 1, fp)) { if (split_at(ibuf, '\n')) - strcat(ibuf, "\r\n"); + strlcat(ibuf, "\r\n", sizeof(ibuf)); percent_x(obuf, sizeof(obuf), ibuf, request); write(request->fd, obuf, strlen(obuf)); } |