From: deraadt Date: Sat, 12 Apr 1997 16:37:37 +0000 (+0000) Subject: botched strncpy, adam@math.tau.ac.il X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=b891f80b104ffa71e6ddcf6721e2af7a8a4f74ab;p=openbsd botched strncpy, adam@math.tau.ac.il --- diff --git a/usr.sbin/ypserv/ypxfr/ypxfr.c b/usr.sbin/ypserv/ypxfr/ypxfr.c index fda6dbf27ad..bd2ca255598 100644 --- a/usr.sbin/ypserv/ypxfr/ypxfr.c +++ b/usr.sbin/ypserv/ypxfr/ypxfr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ypxfr.c,v 1.16 1997/04/12 00:12:58 deraadt Exp $ */ +/* $OpenBSD: ypxfr.c,v 1.17 1997/04/12 16:37:37 deraadt Exp $ */ /* * Copyright (c) 1994 Mats O Jansson @@ -32,7 +32,7 @@ */ #ifndef LINT -static char rcsid[] = "$OpenBSD: ypxfr.c,v 1.16 1997/04/12 00:12:58 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: ypxfr.c,v 1.17 1997/04/12 16:37:37 deraadt Exp $"; #endif #include @@ -148,8 +148,8 @@ u_long *lordernum; if (v.dptr == NULL) { *lordernum = 0; } else { - strncpy(order, v.dptr, v.dsize); - order[v.dsize] = '\0'; + strncpy(order, v.dptr, sizeof order-1); + order[sizeof order-1] = '\0'; *lordernum = (u_long) atol((char *) &order); } }