=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/cvs/root.c,v retrieving revision 1.28 retrieving revision 1.29 diff -c -r1.28 -r1.29 *** src/usr.bin/cvs/root.c 2006/01/02 08:11:56 1.28 --- src/usr.bin/cvs/root.c 2006/01/25 08:15:05 1.29 *************** *** 1,4 **** ! /* $OpenBSD: root.c,v 1.28 2006/01/02 08:11:56 xsa Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau * All rights reserved. --- 1,4 ---- ! /* $OpenBSD: root.c,v 1.29 2006/01/25 08:15:05 xsa Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau * All rights reserved. *************** *** 238,244 **** return cvsroot_parse(cvs_rootstr); l = snprintf(rootpath, sizeof(rootpath), "%s/" CVS_PATH_ROOTSPEC, dir); ! if (l == -1 || l >= (int)sizeof(rootpath)) { errno = ENAMETOOLONG; fatal("cvsroot_get: %s: %s", rootpath, strerror(errno)); } --- 238,247 ---- return cvsroot_parse(cvs_rootstr); l = snprintf(rootpath, sizeof(rootpath), "%s/" CVS_PATH_ROOTSPEC, dir); ! if (strlcpy(rootpath, dir, sizeof(rootpath)) >= sizeof(rootpath) || ! strlcat(rootpath, "/", sizeof(rootpath)) >= sizeof(rootpath) || ! strlcat(rootpath, CVS_PATH_ROOTSPEC, ! sizeof(rootpath)) >= sizeof(rootpath)) { errno = ENAMETOOLONG; fatal("cvsroot_get: %s: %s", rootpath, strerror(errno)); }