strcpy/strcat/sprintf removal in all bootblocks. various testing by
various people. outside of some messy things in src/gnu, only one
thing in the main tree now violates this rule: bind
···11-# $OpenBSD: Makefile.inc,v 1.11 2002/04/29 01:02:28 hugh Exp $
11+# $OpenBSD: Makefile.inc,v 1.12 2003/06/01 17:00:32 deraadt Exp $
22# $NetBSD: Makefile.inc,v 1.5 1996/09/30 16:01:18 ws Exp $
33#
44# NOTE: $S must correspond to the top of the 'sys' tree
···3131 @echo making sure the stand-alone library is up to date...
3232 @${SAMAKE} libsa.a
33333434-clean:: .NOTMAIN __always_make_salib
3434+clean:: .NOTMAIN __always_make_salib
3535 @echo cleaning the stand-alone library objects
3636 @${SAMAKE} clean
3737 -rmdir -p ${SADST}
+7-7
sys/lib/libsa/alloc.c
···11-/* $OpenBSD: alloc.c,v 1.6 2002/03/14 03:16:09 millert Exp $ */
11+/* $OpenBSD: alloc.c,v 1.7 2003/06/01 17:00:32 deraadt Exp $ */
22/* $NetBSD: alloc.c,v 1.6 1997/02/04 18:36:33 thorpej Exp $ */
3344/*
···4040 * SUCH DAMAGE.
4141 *
4242 * @(#)alloc.c 8.1 (Berkeley) 6/11/93
4343- *
4343+ *
4444 *
4545 * Copyright (c) 1989, 1990, 1991 Carnegie Mellon University
4646 * All Rights Reserved.
4747 *
4848 * Author: Alessandro Forin
4949- *
4949+ *
5050 * Permission to use, copy, modify and distribute this software and its
5151 * documentation is hereby granted, provided that both the copyright
5252 * notice and this permission notice appear in all copies of the
5353 * software, derivative works or modified versions, and any portions
5454 * thereof, and that both notices appear in supporting documentation.
5555- *
5555+ *
5656 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
5757 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
5858 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
5959- *
5959+ *
6060 * Carnegie Mellon requests users of this software to return to
6161- *
6161+ *
6262 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
6363 * School of Computer Science
6464 * Carnegie Mellon University
6565 * Pittsburgh PA 15213-3890
6666- *
6666+ *
6767 * any improvements or extensions that they make and grant Carnegie the
6868 * rights to redistribute these changes.
6969 */
+9-9
sys/lib/libsa/arp.c
···11-/* $OpenBSD: arp.c,v 1.9 2002/03/14 03:16:09 millert Exp $ */
11+/* $OpenBSD: arp.c,v 1.10 2003/06/01 17:00:32 deraadt Exp $ */
22/* $NetBSD: arp.c,v 1.15 1996/10/13 02:28:58 christos Exp $ */
3344/*
···8080 struct ether_header eh;
8181 struct {
8282 struct ether_arp arp;
8383- u_char pad[18]; /* 60 - sizeof(...) */
8383+ u_char pad[18]; /* 60 - sizeof(...) */
8484 } data;
8585 } wbuf;
8686 struct {
8787 struct ether_header eh;
8888 struct {
8989 struct ether_arp arp;
9090- u_char pad[24]; /* extra space */
9090+ u_char pad[24]; /* extra space */
9191 } data;
9292 } rbuf;
9393···103103 }
104104105105#ifdef ARP_DEBUG
106106- if (debug)
107107- printf("arpwhohas: send request for %s\n", inet_ntoa(addr));
106106+ if (debug)
107107+ printf("arpwhohas: send request for %s\n", inet_ntoa(addr));
108108#endif
109109110110 bzero((char *)&wbuf.data, sizeof(wbuf.data));
···132132 /* Store ethernet address in cache */
133133 ah = &rbuf.data.arp;
134134#ifdef ARP_DEBUG
135135- if (debug) {
135135+ if (debug) {
136136 printf("arp: response from %s\n",
137137 ether_sprintf(rbuf.eh.ether_shost));
138138 printf("arp: cacheing %s --> %s\n",
···153153{
154154155155#ifdef ARP_DEBUG
156156- if (debug)
156156+ if (debug)
157157 printf("arpsend: called\n");
158158#endif
159159···176176 u_int16_t etype; /* host order */
177177178178#ifdef ARP_DEBUG
179179- if (debug)
179179+ if (debug)
180180 printf("arprecv: ");
181181#endif
182182···244244245245 /* We have our answer. */
246246#ifdef ARP_DEBUG
247247- if (debug)
247247+ if (debug)
248248 printf("got it\n");
249249#endif
250250 return (n);
···11-/* $OpenBSD: close.c,v 1.5 1997/02/06 02:56:44 downsj Exp $ */
11+/* $OpenBSD: close.c,v 1.6 2003/06/01 17:00:32 deraadt Exp $ */
22/* $NetBSD: close.c,v 1.5 1995/09/06 19:53:29 pk Exp $ */
3344/*-
···3737 * SUCH DAMAGE.
3838 *
3939 * @(#)close.c 8.1 (Berkeley) 6/11/93
4040- *
4040+ *
4141 *
4242 * Copyright (c) 1989, 1990, 1991 Carnegie Mellon University
4343 * All Rights Reserved.
4444 *
4545 * Author: Alessandro Forin
4646- *
4646+ *
4747 * Permission to use, copy, modify and distribute this software and its
4848 * documentation is hereby granted, provided that both the copyright
4949 * notice and this permission notice appear in all copies of the
5050 * software, derivative works or modified versions, and any portions
5151 * thereof, and that both notices appear in supporting documentation.
5252- *
5252+ *
5353 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
5454 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
5555 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
5656- *
5656+ *
5757 * Carnegie Mellon requests users of this software to return to
5858- *
5858+ *
5959 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
6060 * School of Computer Science
6161 * Carnegie Mellon University
6262 * Pittsburgh PA 15213-3890
6363- *
6363+ *
6464 * any improvements or extensions that they make and grant Carnegie the
6565 * rights to redistribute these changes.
6666 */
+7-7
sys/lib/libsa/closeall.c
···11-/* $OpenBSD: closeall.c,v 1.2 1996/09/23 14:18:50 mickey Exp $ */
11+/* $OpenBSD: closeall.c,v 1.3 2003/06/01 17:00:32 deraadt Exp $ */
22/* $NetBSD: close.c,v 1.5 1995/09/06 19:53:29 pk Exp $ */
3344/*-
···3737 * SUCH DAMAGE.
3838 *
3939 * @(#)close.c 8.1 (Berkeley) 6/11/93
4040- *
4040+ *
4141 *
4242 * Copyright (c) 1989, 1990, 1991 Carnegie Mellon University
4343 * All Rights Reserved.
4444 *
4545 * Author: Alessandro Forin
4646- *
4646+ *
4747 * Permission to use, copy, modify and distribute this software and its
4848 * documentation is hereby granted, provided that both the copyright
4949 * notice and this permission notice appear in all copies of the
5050 * software, derivative works or modified versions, and any portions
5151 * thereof, and that both notices appear in supporting documentation.
5252- *
5252+ *
5353 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
5454 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
5555 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
5656- *
5656+ *
5757 * Carnegie Mellon requests users of this software to return to
5858- *
5858+ *
5959 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
6060 * School of Computer Science
6161 * Carnegie Mellon University
6262 * Pittsburgh PA 15213-3890
6363- *
6363+ *
6464 * any improvements or extensions that they make and grant Carnegie the
6565 * rights to redistribute these changes.
6666 */
···11-/* $OpenBSD: exit.c,v 1.6 2002/03/15 18:19:52 millert Exp $ */
11+/* $OpenBSD: exit.c,v 1.7 2003/06/01 17:00:32 deraadt Exp $ */
22/* $NetBSD: exit.c,v 1.11 1996/12/01 20:22:19 pk Exp $ */
3344/*-
55 * Copyright (c) 1993 John Brezak
66 * All rights reserved.
77- *
77+ *
88 * Redistribution and use in source and binary forms, with or without
99 * modification, are permitted provided that the following conditions
1010 * are met:
···1515 * documentation and/or other materials provided with the distribution.
1616 * 3. The name of the author may not be used to endorse or promote products
1717 * derived from this software without specific prior written permission.
1818- *
1818+ *
1919 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR `AS IS'' AND ANY EXPRESS OR
2020 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
2121 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
···3636__dead void
3737panic(const char *fmt, ...)
3838{
3939- extern void closeall(void);
4040- va_list ap;
4141- static int paniced;
4242-4343- if (!paniced) {
4444- paniced = 1;
4545- closeall();
4646- }
3939+ extern void closeall(void);
4040+ va_list ap;
4141+ static int paniced;
47424848- va_start(ap, fmt);
4949- vprintf(fmt, ap);
5050- printf("\n");
5151- va_end(ap);
5252- _rtt();
5353- /*NOTREACHED*/
4343+ if (!paniced) {
4444+ paniced = 1;
4545+ closeall();
4646+ }
4747+4848+ va_start(ap, fmt);
4949+ vprintf(fmt, ap);
5050+ printf("\n");
5151+ va_end(ap);
5252+ _rtt();
5353+ /*NOTREACHED*/
5454}
55555656void
5757exit()
5858{
5959- panic("exit");
6060- /*NOTREACHED*/
5959+ panic("exit");
6060+ /*NOTREACHED*/
6161}
+7-7
sys/lib/libsa/ioctl.c
···11-/* $OpenBSD: ioctl.c,v 1.2 1996/09/23 14:18:55 mickey Exp $ */
11+/* $OpenBSD: ioctl.c,v 1.3 2003/06/01 17:00:32 deraadt Exp $ */
22/* $NetBSD: ioctl.c,v 1.4 1994/10/30 21:48:24 cgd Exp $ */
3344/*-
···3737 * SUCH DAMAGE.
3838 *
3939 * @(#)ioctl.c 8.1 (Berkeley) 6/11/93
4040- *
4040+ *
4141 *
4242 * Copyright (c) 1989, 1990, 1991 Carnegie Mellon University
4343 * All Rights Reserved.
4444 *
4545 * Author: Alessandro Forin
4646- *
4646+ *
4747 * Permission to use, copy, modify and distribute this software and its
4848 * documentation is hereby granted, provided that both the copyright
4949 * notice and this permission notice appear in all copies of the
5050 * software, derivative works or modified versions, and any portions
5151 * thereof, and that both notices appear in supporting documentation.
5252- *
5252+ *
5353 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
5454 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
5555 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
5656- *
5656+ *
5757 * Carnegie Mellon requests users of this software to return to
5858- *
5858+ *
5959 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
6060 * School of Computer Science
6161 * Carnegie Mellon University
6262 * Pittsburgh PA 15213-3890
6363- *
6363+ *
6464 * any improvements or extensions that they make and grant Carnegie the
6565 * rights to redistribute these changes.
6666 */
+2-2
sys/lib/libsa/iodesc.h
···11-/* $OpenBSD: iodesc.h,v 1.2 1996/09/23 14:18:56 mickey Exp $ */
11+/* $OpenBSD: iodesc.h,v 1.3 2003/06/01 17:00:32 deraadt Exp $ */
22/* $NetBSD: iodesc.h,v 1.4 1995/09/23 03:31:50 gwr Exp $ */
3344/*
55- * Copyright (c) 1993 Adam Glass
55+ * Copyright (c) 1993 Adam Glass
66 * Copyright (c) 1992 Regents of the University of California.
77 * All rights reserved.
88 *
···11-/* $OpenBSD: lseek.c,v 1.4 1997/02/06 02:56:45 downsj Exp $ */
11+/* $OpenBSD: lseek.c,v 1.5 2003/06/01 17:00:33 deraadt Exp $ */
22/* $NetBSD: lseek.c,v 1.3 1996/06/21 20:09:03 pk Exp $ */
3344/*-
···3737 * SUCH DAMAGE.
3838 *
3939 * @(#)lseek.c 8.1 (Berkeley) 6/11/93
4040- *
4040+ *
4141 *
4242 * Copyright (c) 1989, 1990, 1991 Carnegie Mellon University
4343 * All Rights Reserved.
4444 *
4545 * Author: Alessandro Forin
4646- *
4646+ *
4747 * Permission to use, copy, modify and distribute this software and its
4848 * documentation is hereby granted, provided that both the copyright
4949 * notice and this permission notice appear in all copies of the
5050 * software, derivative works or modified versions, and any portions
5151 * thereof, and that both notices appear in supporting documentation.
5252- *
5252+ *
5353 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
5454 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
5555 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
5656- *
5656+ *
5757 * Carnegie Mellon requests users of this software to return to
5858- *
5858+ *
5959 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
6060 * School of Computer Science
6161 * Carnegie Mellon University
6262 * Pittsburgh PA 15213-3890
6363- *
6363+ *
6464 * any improvements or extensions that they make and grant Carnegie the
6565 * rights to redistribute these changes.
6666 */
···11-/* $OpenBSD: nfs.c,v 1.8 1997/03/25 20:30:43 niklas Exp $ */
11+/* $OpenBSD: nfs.c,v 1.9 2003/06/01 17:00:33 deraadt Exp $ */
22/* $NetBSD: nfs.c,v 1.19 1996/10/13 02:29:04 christos Exp $ */
3344/*-
55 * Copyright (c) 1993 John Brezak
66 * All rights reserved.
77- *
77+ *
88 * Redistribution and use in source and binary forms, with or without
99 * modification, are permitted provided that the following conditions
1010 * are met:
···1515 * documentation and/or other materials provided with the distribution.
1616 * 3. The name of the author may not be used to endorse or promote products
1717 * derived from this software without specific prior written permission.
1818- *
1818+ *
1919 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR `AS IS'' AND ANY EXPRESS OR
2020 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
2121 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
···126126 struct repl d;
127127 } rdata;
128128 size_t cc;
129129-129129+130130#ifdef NFS_DEBUG
131131 if (debug)
132132 printf("nfs_getrootfh: %s\n", path);
···191191 struct repl d;
192192 } rdata;
193193 ssize_t cc;
194194-194194+195195#ifdef NFS_DEBUG
196196 if (debug)
197197 printf("lookupfh: called\n");
···259259260260 if (cc < 4)
261261 return (EIO);
262262-262262+263263 if (rdata.d.errno)
264264 return (ntohl(rdata.d.errno));
265265···390390 int error = 0;
391391392392#ifdef NFS_DEBUG
393393- if (debug)
394394- printf("nfs_open: %s\n", path);
393393+ if (debug)
394394+ printf("nfs_open: %s\n", path);
395395#endif
396396 if (nfs_root_node.iodesc == NULL) {
397397 printf("nfs_open: must mount first.\n");
···400400401401 currfd = &nfs_root_node;
402402 newfd = 0;
403403-403403+404404 cp = path;
405405 while (*cp) {
406406 /*
···418418 error = ENOTDIR;
419419 goto out;
420420 }
421421-421421+422422 /* allocate file system specific data structure */
423423 newfd = alloc(sizeof(*newfd));
424424 newfd->iodesc = currfd->iodesc;
425425 newfd->off = 0;
426426-426426+427427 /*
428428 * Get next component of path name.
429429 */
430430 {
431431 register int len = 0;
432432-432432+433433 ncp = cp;
434434 while ((c = *cp) != '\0' && c != '/') {
435435 if (++len > NFS_MAXNAMLEN) {
···440440 }
441441 *cp = '\0';
442442 }
443443-443443+444444 /* lookup a file handle */
445445 error = nfs_lookupfh(currfd, ncp, newfd);
446446 *cp = c;
447447 if (error)
448448 goto out;
449449-449449+450450 /*
451451 * Check for symbolic link
452452 */
453453 if (newfd->fa.fa_type == htonl(NFLNK)) {
454454 int link_len, len;
455455-455455+456456 error = nfs_readlink(newfd, linkbuf);
457457 if (error)
458458 goto out;
···468468469469 bcopy(cp, &namebuf[link_len], len + 1);
470470 bcopy(linkbuf, namebuf, link_len);
471471-471471+472472 /*
473473 * If absolute pathname, restart at root.
474474 * If relative pathname, restart at parent directory.
···482482483483 free(newfd, sizeof(*newfd));
484484 newfd = 0;
485485-485485+486486 continue;
487487 }
488488-488488+489489 if (currfd != &nfs_root_node)
490490 free(currfd, sizeof(*currfd));
491491 currfd = newfd;
···499499 f->f_fsdata = (void *)currfd;
500500 return (0);
501501 }
502502-502502+503503#ifdef NFS_DEBUG
504504 if (debug)
505505 printf("nfs_open: %s lookupfh failed: %s\n",
···527527 if (fp)
528528 free(fp, sizeof(struct nfs_iodesc));
529529 f->f_fsdata = (void *)0;
530530-530530+531531 return (0);
532532}
533533···544544 register struct nfs_iodesc *fp = (struct nfs_iodesc *)f->f_fsdata;
545545 register ssize_t cc;
546546 register char *addr = buf;
547547-547547+548548#ifdef NFS_DEBUG
549549 if (debug)
550550 printf("nfs_read: size=%d off=%d\n", size, (int)fp->off);
+7-7
sys/lib/libsa/nullfs.c
···11-/* $OpenBSD: nullfs.c,v 1.4 1997/05/04 22:41:24 millert Exp $ */
11+/* $OpenBSD: nullfs.c,v 1.5 2003/06/01 17:00:33 deraadt Exp $ */
22/* $NetBSD: open.c,v 1.9 1995/09/19 09:16:52 thorpej Exp $ */
3344/*-
···3737 * SUCH DAMAGE.
3838 *
3939 * @(#)open.c 8.1 (Berkeley) 6/11/93
4040- *
4040+ *
4141 *
4242 * Copyright (c) 1989, 1990, 1991 Carnegie Mellon University
4343 * All Rights Reserved.
4444 *
4545 * Author: Alessandro Forin
4646- *
4646+ *
4747 * Permission to use, copy, modify and distribute this software and its
4848 * documentation is hereby granted, provided that both the copyright
4949 * notice and this permission notice appear in all copies of the
5050 * software, derivative works or modified versions, and any portions
5151 * thereof, and that both notices appear in supporting documentation.
5252- *
5252+ *
5353 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
5454 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
5555 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
5656- *
5656+ *
5757 * Carnegie Mellon requests users of this software to return to
5858- *
5858+ *
5959 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
6060 * School of Computer Science
6161 * Carnegie Mellon University
6262 * Pittsburgh PA 15213-3890
6363- *
6363+ *
6464 * any improvements or extensions that they make and grant Carnegie the
6565 * rights to redistribute these changes.
6666 */
+7-7
sys/lib/libsa/open.c
···11-/* $OpenBSD: open.c,v 1.7 1998/09/11 01:41:18 millert Exp $ */
11+/* $OpenBSD: open.c,v 1.8 2003/06/01 17:00:33 deraadt Exp $ */
22/* $NetBSD: open.c,v 1.12 1996/09/30 16:01:21 ws Exp $ */
3344/*-
···3737 * SUCH DAMAGE.
3838 *
3939 * @(#)open.c 8.1 (Berkeley) 6/11/93
4040- *
4040+ *
4141 *
4242 * Copyright (c) 1989, 1990, 1991 Carnegie Mellon University
4343 * All Rights Reserved.
4444 *
4545 * Author: Alessandro Forin
4646- *
4646+ *
4747 * Permission to use, copy, modify and distribute this software and its
4848 * documentation is hereby granted, provided that both the copyright
4949 * notice and this permission notice appear in all copies of the
5050 * software, derivative works or modified versions, and any portions
5151 * thereof, and that both notices appear in supporting documentation.
5252- *
5252+ *
5353 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
5454 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
5555 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
5656- *
5656+ *
5757 * Carnegie Mellon requests users of this software to return to
5858- *
5858+ *
5959 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
6060 * School of Computer Science
6161 * Carnegie Mellon University
6262 * Pittsburgh PA 15213-3890
6363- *
6363+ *
6464 * any improvements or extensions that they make and grant Carnegie the
6565 * rights to redistribute these changes.
6666 */
···11-/* $OpenBSD: read.c,v 1.4 1997/02/06 02:56:46 downsj Exp $ */
11+/* $OpenBSD: read.c,v 1.5 2003/06/01 17:00:33 deraadt Exp $ */
22/* $NetBSD: read.c,v 1.7 1996/06/21 20:29:28 pk Exp $ */
3344/*-
···3737 * SUCH DAMAGE.
3838 *
3939 * @(#)read.c 8.1 (Berkeley) 6/11/93
4040- *
4040+ *
4141 *
4242 * Copyright (c) 1989, 1990, 1991 Carnegie Mellon University
4343 * All Rights Reserved.
4444 *
4545 * Author: Alessandro Forin
4646- *
4646+ *
4747 * Permission to use, copy, modify and distribute this software and its
4848 * documentation is hereby granted, provided that both the copyright
4949 * notice and this permission notice appear in all copies of the
5050 * software, derivative works or modified versions, and any portions
5151 * thereof, and that both notices appear in supporting documentation.
5252- *
5252+ *
5353 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
5454 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
5555 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
5656- *
5656+ *
5757 * Carnegie Mellon requests users of this software to return to
5858- *
5858+ *
5959 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
6060 * School of Computer Science
6161 * Carnegie Mellon University
6262 * Pittsburgh PA 15213-3890
6363- *
6363+ *
6464 * any improvements or extensions that they make and grant Carnegie the
6565 * rights to redistribute these changes.
6666 */
+4-4
sys/lib/libsa/readdir.c
···11-/* $OpenBSD: readdir.c,v 1.4 1997/07/21 15:43:54 mickey Exp $ */
11+/* $OpenBSD: readdir.c,v 1.5 2003/06/01 17:00:33 deraadt Exp $ */
2233/*
44 * Copyright (c) 1996 Michael Shalayeff
···1818 * 4. The name of the author may not be used to endorse or promote products
1919 * derived from this software without specific prior written permission.
2020 *
2121- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
2222- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
2121+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
2222+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
2323 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2424 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
2525 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
···68686969 return fd;
7070}
7171-7171+7272int
7373readdir(fd, dest)
7474 int fd;
+7-7
sys/lib/libsa/rpc.c
···11-/* $OpenBSD: rpc.c,v 1.11 2002/03/14 01:27:07 millert Exp $ */
11+/* $OpenBSD: rpc.c,v 1.12 2003/06/01 17:00:33 deraadt Exp $ */
22/* $NetBSD: rpc.c,v 1.16 1996/10/13 02:29:06 christos Exp $ */
3344/*
···6262#include "rpc.h"
63636464struct auth_info {
6565- int32_t authtype; /* auth type */
6565+ int32_t authtype; /* auth type */
6666 u_int32_t authlen; /* auth length */
6767};
6868···76767777struct rpc_call {
7878 u_int32_t rp_xid; /* request transaction id */
7979- int32_t rp_direction; /* call direction (0) */
7979+ int32_t rp_direction; /* call direction (0) */
8080 u_int32_t rp_rpcvers; /* rpc version (2) */
8181 u_int32_t rp_prog; /* program */
8282 u_int32_t rp_vers; /* version */
···85858686struct rpc_reply {
8787 u_int32_t rp_xid; /* request transaction id */
8888- int32_t rp_direction; /* call direction (1) */
8989- int32_t rp_astatus; /* accept status (0: accepted) */
8888+ int32_t rp_direction; /* call direction (1) */
8989+ int32_t rp_astatus; /* accept status (0: accepted) */
9090 union {
9191 u_int32_t rpu_errno;
9292 struct {
···321321 struct in_addr addr; /* server, net order */
322322 u_int prog; /* host order */
323323 u_int vers; /* host order */
324324- int port; /* host order */
324324+ int port; /* host order */
325325} rpc_pmap_list[PMAP_NUM];
326326327327/* return port number in host order, or -1 */
···348348 struct in_addr addr; /* server, net order */
349349 u_int prog; /* host order */
350350 u_int vers; /* host order */
351351- int port; /* host order */
351351+ int port; /* host order */
352352{
353353 struct pmap_list *pl;
354354
+83
sys/lib/libsa/snprintf.c
···11+/* $OpenBSD: snprintf.c,v 1.1 2003/06/01 17:00:33 deraadt Exp $ */
22+/* $NetBSD: printf.c,v 1.10 1996/11/30 04:19:21 gwr Exp $ */
33+44+/*-
55+ * Copyright (c) 1993
66+ * The Regents of the University of California. All rights reserved.
77+ *
88+ * Redistribution and use in source and binary forms, with or without
99+ * modification, are permitted provided that the following conditions
1010+ * are met:
1111+ * 1. Redistributions of source code must retain the above copyright
1212+ * notice, this list of conditions and the following disclaimer.
1313+ * 2. Redistributions in binary form must reproduce the above copyright
1414+ * notice, this list of conditions and the following disclaimer in the
1515+ * documentation and/or other materials provided with the distribution.
1616+ * 3. All advertising materials mentioning features or use of this software
1717+ * must display the following acknowledgement:
1818+ * This product includes software developed by the University of
1919+ * California, Berkeley and its contributors.
2020+ * 4. Neither the name of the University nor the names of its contributors
2121+ * may be used to endorse or promote products derived from this software
2222+ * without specific prior written permission.
2323+ *
2424+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
2525+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2626+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2727+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
2828+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2929+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
3030+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
3131+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
3232+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
3333+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
3434+ * SUCH DAMAGE.
3535+ *
3636+ * @(#)printf.c 8.1 (Berkeley) 6/11/93
3737+ */
3838+3939+#include <sys/cdefs.h>
4040+#include <sys/types.h>
4141+#include <machine/stdarg.h>
4242+4343+#include "stand.h"
4444+4545+extern void kprintn(void (*)(int), u_long, int);
4646+extern void kdoprnt(void (*)(int), const char *, va_list);
4747+4848+#ifndef STRIPPED
4949+static void sputchar(int);
5050+5151+static char *sbuf, *sbuf_end;
5252+static size_t sbuf_len;
5353+5454+void
5555+sputchar(c)
5656+ int c;
5757+{
5858+ if (sbuf < sbuf_end)
5959+ *sbuf = c;
6060+ sbuf++;
6161+}
6262+6363+int
6464+snprintf(char *buf, size_t len, const char *fmt, ...)
6565+{
6666+ va_list ap;
6767+6868+ sbuf = buf;
6969+ sbuf_len = len;
7070+ sbuf_end = sbuf + len;
7171+ va_start(ap, fmt);
7272+ kdoprnt(sputchar, fmt, ap);
7373+ va_end(ap);
7474+7575+ if (sbuf < sbuf_end)
7676+ *sbuf = '\0';
7777+ else if (len > 0)
7878+ *(sbuf_end - 1) = '\0';
7979+8080+ return sbuf - buf;
8181+}
8282+8383+#endif /* STRIPPED */
···11-/* $OpenBSD: strcmp.c,v 1.2 1996/10/16 11:32:07 mickey Exp $ */
11+/* $OpenBSD: strcmp.c,v 1.3 2003/06/01 17:00:33 deraadt Exp $ */
2233/*-
44 * Copyright (c) 1996 Michael Shalayeff
···1818 * 4. The name of the author may not be used to endorse or promote products
1919 * derived from this software without specific prior written permission.
2020 *
2121- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
2222- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
2121+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
2222+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
2323 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2424 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
2525 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
···11-/* $OpenBSD: strncmp.c,v 1.1 1997/02/06 06:47:00 mickey Exp $ */
11+/* $OpenBSD: strncmp.c,v 1.2 2003/06/01 17:00:33 deraadt Exp $ */
2233/*-
44 * Copyright (c) 1996 Michael Shalayeff
···1818 * 4. The name of the author may not be used to endorse or promote products
1919 * derived from this software without specific prior written permission.
2020 *
2121- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
2222- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
2121+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
2222+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
2323 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2424 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
2525 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+3-3
sys/lib/libsa/strncpy.c
···11-/* $OpenBSD: strncpy.c,v 1.1 1996/10/16 11:32:07 mickey Exp $ */
11+/* $OpenBSD: strncpy.c,v 1.2 2003/06/01 17:00:33 deraadt Exp $ */
2233/*-
44 * Copyright (c) 1996 Michael Shalayeff
···1818 * 4. The name of the author may not be used to endorse or promote products
1919 * derived from this software without specific prior written permission.
2020 *
2121- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
2222- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
2121+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
2222+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
2323 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2424 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
2525 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+21-23
sys/lib/libsa/ufs.c
···11-/* $OpenBSD: ufs.c,v 1.13 2002/03/14 01:27:07 millert Exp $ */
11+/* $OpenBSD: ufs.c,v 1.14 2003/06/01 17:00:33 deraadt Exp $ */
22/* $NetBSD: ufs.c,v 1.16 1996/09/30 16:01:22 ws Exp $ */
3344/*-
···3535 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
3636 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
3737 * SUCH DAMAGE.
3838- *
3838+ *
3939 *
4040 * Copyright (c) 1990, 1991 Carnegie Mellon University
4141 * All Rights Reserved.
4242 *
4343 * Author: David Golub
4444- *
4444+ *
4545 * Permission to use, copy, modify and distribute this software and its
4646 * documentation is hereby granted, provided that both the copyright
4747 * notice and this permission notice appear in all copies of the
4848 * software, derivative works or modified versions, and any portions
4949 * thereof, and that both notices appear in supporting documentation.
5050- *
5050+ *
5151 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
5252 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
5353 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
5454- *
5454+ *
5555 * Carnegie Mellon requests users of this software to return to
5656- *
5656+ *
5757 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
5858 * School of Computer Science
5959 * Carnegie Mellon University
6060 * Pittsburgh PA 15213-3890
6161- *
6161+ *
6262 * any improvements or extensions that they make and grant Carnegie the
6363 * rights to redistribute these changes.
6464 */
···125125 buf = alloc(fs->fs_bsize);
126126 twiddle();
127127 rc = (f->f_dev->dv_strategy)(f->f_devdata, F_READ,
128128- fsbtodb(fs, ino_to_fsba(fs, inumber)), fs->fs_bsize,
129129- buf, &rsize);
128128+ fsbtodb(fs, ino_to_fsba(fs, inumber)), fs->fs_bsize,
129129+ buf, &rsize);
130130 if (rc)
131131 goto out;
132132 if (rsize != (size_t)fs->fs_bsize) {
···153153 }
154154out:
155155 free(buf, fs->fs_bsize);
156156- return (rc);
156156+ return (rc);
157157}
158158159159/*
···232232 if (fp->f_blkno[level] != ind_block_num) {
233233 if (fp->f_blk[level] == (char *)0)
234234 fp->f_blk[level] =
235235- alloc(fs->fs_bsize);
235235+ alloc(fs->fs_bsize);
236236 twiddle();
237237 rc = (f->f_dev->dv_strategy)(f->f_devdata, F_READ,
238238- fsbtodb(fp->f_fs, ind_block_num),
239239- fs->fs_bsize,
240240- fp->f_blk[level],
241241- &fp->f_blksize[level]);
238238+ fsbtodb(fp->f_fs, ind_block_num), fs->fs_bsize,
239239+ fp->f_blk[level], &fp->f_blksize[level]);
242240 if (rc)
243241 return (rc);
244242 if (fp->f_blksize[level] != (size_t)fs->fs_bsize)
···298296 } else {
299297 twiddle();
300298 rc = (f->f_dev->dv_strategy)(f->f_devdata, F_READ,
301301- fsbtodb(fs, disk_block),
302302- block_size, fp->f_buf, &fp->f_buf_size);
299299+ fsbtodb(fs, disk_block),
300300+ block_size, fp->f_buf, &fp->f_buf_size);
303301 if (rc)
304302 return (rc);
305303 }
···404402 fp->f_fs = fs;
405403 twiddle();
406404 rc = (f->f_dev->dv_strategy)(f->f_devdata, F_READ,
407407- SBLOCK, SBSIZE, (char *)fs, &buf_size);
405405+ SBLOCK, SBSIZE, (char *)fs, &buf_size);
408406 if (rc)
409407 goto out;
410408···507505508506 if (link_len < fs->fs_maxsymlinklen) {
509507 bcopy(fp->f_di.di_shortlink, namebuf,
510510- (unsigned) link_len);
508508+ (unsigned) link_len);
511509 } else {
512510 /*
513511 * Read file for symbolic link
···521519 rc = block_map(f, (daddr_t)0, &disk_block);
522520 if (rc)
523521 goto out;
524524-522522+525523 twiddle();
526524 rc = (f->f_dev->dv_strategy)(f->f_devdata,
527527- F_READ, fsbtodb(fs, disk_block),
528528- fs->fs_bsize, buf, &buf_size);
525525+ F_READ, fsbtodb(fs, disk_block),
526526+ fs->fs_bsize, buf, &buf_size);
529527 if (rc)
530528 goto out;
531529···707705 while (dp < edp && dp->d_ino == (ino_t)0)
708706 dp = (struct direct *)((char *)dp + dp->d_reclen);
709707 fp->f_seekp += buf_size -
710710- ((u_int8_t *)edp - (u_int8_t *)dp);
708708+ ((u_int8_t *)edp - (u_int8_t *)dp);
711709 } while (dp >= edp);
712710713711#if BYTE_ORDER == LITTLE_ENDIAN
+10-8
sys/lib/libsa/unixdev.c
···11-/* $OpenBSD: unixdev.c,v 1.4 1998/05/25 18:37:30 mickey Exp $ */
11+/* $OpenBSD: unixdev.c,v 1.5 2003/06/01 17:00:33 deraadt Exp $ */
2233/*
44 * Copyright (c) 1996-1998 Michael Shalayeff
···1818 * 4. The name of the author may not be used to endorse or promote products
1919 * derived from this software without specific prior written permission.
2020 *
2121- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
2222- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
2121+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
2222+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
2323 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2424 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
2525 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
···56565757#ifdef UNIX_DEBUG
5858 printf("unixstrategy: %s %d bytes @ %d\n",
5959- (rw==F_READ?"reading":"writing"), size, blk);
5959+ (rw==F_READ?"reading":"writing"), size, blk);
6060#endif
6161 if ((rc = ulseek((int)devdata, blk * DEV_BSIZE, 0)) >= 0)
6262- rc = rw==F_READ? uread((int)devdata, buf, size) :
6363- uwrite((int)devdata, buf, size);
6262+ rc = (rw==F_READ) ? uread((int)devdata, buf, size) :
6363+ uwrite((int)devdata, buf, size);
64646565 if (rc >= 0) {
6666 *rsize = (size_t)rc;
···88888989 if (strncmp("/dev/", *file, 5) == 0) {
9090 /* p = strchr(p + 5, '/') */
9191- for (p = *file + 5; *p != '\0' && *p != '/'; p++);
9191+ for (p = *file + 5; *p != '\0' && *p != '/'; p++)
9292+ ;
9293 if (*p == '/')
9394 *p = '\0';
9495 }
···99100 if (p != NULL)
100101 *p = '/';
101102102102- return fd<0? -1: 0;
103103+ return fd < 0 ? -1 : 0;
103104}
104105105106int
···171172 return 1;
172173 } else {
173174 char c;
175175+174176 return uread(0, &c, 1)<1? -1: c;
175177 }
176178}
+3-3
sys/lib/libsa/unixdev.h
···11-/* $OpenBSD: unixdev.h,v 1.4 2002/03/14 01:27:07 millert Exp $ */
11+/* $OpenBSD: unixdev.h,v 1.5 2003/06/01 17:00:33 deraadt Exp $ */
2233/*
44 * Copyright (c) 1996 Michael Shalayeff
···1818 * 4. The name of the author may not be used to endorse or promote products
1919 * derived from this software without specific prior written permission.
2020 *
2121- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
2222- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
2121+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
2222+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
2323 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2424 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
2525 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+8-8
sys/lib/libsa/write.c
···11-/* $OpenBSD: write.c,v 1.3 1996/12/08 15:15:59 niklas Exp $ */
11+/* $OpenBSD: write.c,v 1.4 2003/06/01 17:00:33 deraadt Exp $ */
22/* $NetBSD: write.c,v 1.7 1996/06/21 20:29:30 pk Exp $ */
3344/*-
···3737 * SUCH DAMAGE.
3838 *
3939 * @(#)write.c 8.1 (Berkeley) 6/11/93
4040- *
4040+ *
4141 *
4242 * Copyright (c) 1989, 1990, 1991 Carnegie Mellon University
4343 * All Rights Reserved.
4444 *
4545 * Author: Alessandro Forin
4646- *
4646+ *
4747 * Permission to use, copy, modify and distribute this software and its
4848 * documentation is hereby granted, provided that both the copyright
4949 * notice and this permission notice appear in all copies of the
5050 * software, derivative works or modified versions, and any portions
5151 * thereof, and that both notices appear in supporting documentation.
5252- *
5252+ *
5353 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
5454 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
5555 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
5656- *
5656+ *
5757 * Carnegie Mellon requests users of this software to return to
5858- *
5858+ *
5959 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
6060 * School of Computer Science
6161 * Carnegie Mellon University
6262 * Pittsburgh PA 15213-3890
6363- *
6363+ *
6464 * any improvements or extensions that they make and grant Carnegie the
6565 * rights to redistribute these changes.
6666 */
···8484 if (f->f_flags & F_RAW) {
8585 twiddle();
8686 errno = (f->f_dev->dv_strategy)(f->f_devdata, F_WRITE,
8787- btodb(f->f_offset), bcount, dest, &resid);
8787+ btodb(f->f_offset), bcount, dest, &resid);
8888 if (errno)
8989 return (-1);
9090 f->f_offset += resid;
+8-7
sys/stand/boot/boot.c
···11-/* $OpenBSD: boot.c,v 1.26 2003/05/19 08:18:25 mickey Exp $ */
11+/* $OpenBSD: boot.c,v 1.27 2003/06/01 17:00:26 deraadt Exp $ */
2233/*
44 * Copyright (c) 2003 Dale Rahn
···1919 * 4. The name of the author may not be used to endorse or promote products
2020 * derived from this software without specific prior written permission.
2121 *
2222- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
2323- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
2222+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
2323+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
2424 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2525 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
2626 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
···3838#include <sys/stat.h>
3939#include <libsa.h>
4040#include <lib/libsa/loadfile.h>
4141+#include <lib/libkern/funcs.h>
41424243#include "cmd.h"
4343-44444545static const char *const kernels[] = {
4646 "/bsd",
···6666 printf(">> OpenBSD/" MACHINE " BOOT %s\n", version);
67676868 devboot(bootdev, cmd.bootdev);
6969- strncpy(cmd.image, bootfile, sizeof(cmd.image));
6969+ strlcpy(cmd.image, bootfile, sizeof(cmd.image));
7070 cmd.boothowto = 0;
7171 cmd.conf = "/etc/boot.conf";
7272 cmd.addr = (void *)DEFAULT_KERNEL_ADDRESS;
···74747575 st = read_conf();
7676 if (!bootprompt)
7777- sprintf(cmd.path, "%s:%s", cmd.bootdev, cmd.image);
7777+ snprintf(cmd.path, sizeof cmd.path, "%s:%s",
7878+ cmd.bootdev, cmd.image);
78797980 while (1) {
8081 /* no boot.conf, or no boot cmd in there */
···9596 bootfile = kernels[i=0];
9697 } else
9798 bootfile = kernels[i];
9898- strncpy(cmd.image, bootfile, sizeof(cmd.image));
9999+ strlcpy(cmd.image, bootfile, sizeof(cmd.image));
99100 printf(" failed(%d). will try %s\n", errno, bootfile);
100101101102 if (try < 2)
+3-3
sys/stand/boot/bootarg.c
···11-/* $OpenBSD: bootarg.c,v 1.7 2002/03/14 03:16:12 millert Exp $ */
11+/* $OpenBSD: bootarg.c,v 1.8 2003/06/01 17:00:27 deraadt Exp $ */
2233/*
44 * Copyright (c) 1997,1998 Michael Shalayeff
···1818 * 4. The name of the author may not be used to endorse or promote products
1919 * derived from this software without specific prior written permission.
2020 *
2121- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
2222- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
2121+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
2222+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
2323 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2424 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
2525 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
···11-/* $OpenBSD: cmd.c,v 1.48 2002/07/14 09:19:17 mdw Exp $ */
11+/* $OpenBSD: cmd.c,v 1.49 2003/06/01 17:00:27 deraadt Exp $ */
2233/*
44 * Copyright (c) 1997-1999 Michael Shalayeff
···1818 * 4. The name of the author may not be used to endorse or promote products
1919 * derived from this software without specific prior written permission.
2020 *
2121- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
2222- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
2121+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
2222+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
2323 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2424 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
2525 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
···3535#include <sys/param.h>
3636#include <libsa.h>
3737#include <sys/reboot.h>
3838+#include <lib/libkern/funcs.h>
3839#include "cmd.h"
39404041#define CTRL(c) ((c)&0x1f)
···122123123124 cmd.cmd = NULL;
124125125125- do
126126+ do {
126127 eof = read(fd, p, 1);
127127- while (eof > 0 && *p++ != '\n');
128128+ } while (eof > 0 && *p++ != '\n');
128129129130 if (eof < 0)
130131 printf("%s: %s\n", cmd.path, strerror(errno));
···239240 break;
240241241242 if (!cnischar()) {
242242- strncpy(buf, "boot", 5);
243243+ strlcpy(buf, "boot", 5);
243244 putchar('\n');
244245 return strlen(buf);
245246 }
246247 } else
247247- while (!cnischar()) ;
248248+ while (!cnischar())
249249+ ;
248250249251 while (1) {
250252 switch ((ch = getchar())) {
···283285/*
284286 * Search for spaces/tabs after the current word. If found, \0 the
285287 * first one. Then pass a pointer to the first character of the
286286- * next word, or NULL if there is no next word.
288288+ * next word, or NULL if there is no next word.
287289 */
288290char *
289291nextword(p)
···407409 }
408410409411 /* no strlen in lib !!! */
410410- for (p = cmd.path; *p; p++);
412412+ for (p = cmd.path; *p; p++)
413413+ ;
411414 *p++ = '/';
412415 *p = '\0';
413416···439442 lsrwx(sb->st_mode , (sb->st_mode & S_ISTXT? "tT" : "x-"));
440443441444 printf (" %u,%u\t%lu\t%s\n", sb->st_uid, sb->st_gid,
442442- (u_long)sb->st_size, name);
445445+ (u_long)sb->st_size, name);
443446}
444447#undef lsrwx
445448···466469 } else {
467470 if (bootparse(1))
468471 return 0;
469469- sprintf(cmd.path, "%s:%s", cmd.bootdev, cmd.image);
472472+ snprintf(cmd.path, sizeof cmd.path, "%s:%s",
473473+ cmd.bootdev, cmd.image);
470474 }
471475472476 return 1;
···486490 if (*p == ':')
487491 break;
488492 if (*p == ':')
489489- strncpy(cmd.path, name, sizeof(cmd.path));
493493+ strlcpy(cmd.path, name, sizeof(cmd.path));
490494 else
491491- sprintf(cmd.path, "%s:%s", cmd.bootdev, name);
495495+ snprintf(cmd.path, sizeof cmd.path, "%s:%s",
496496+ cmd.bootdev, name);
492497 return cmd.path;
493498}
494499
+3-3
sys/stand/boot/cmd.h
···11-/* $OpenBSD: cmd.h,v 1.11 2002/03/14 01:27:13 millert Exp $ */
11+/* $OpenBSD: cmd.h,v 1.12 2003/06/01 17:00:27 deraadt Exp $ */
2233/*
44 * Copyright (c) 1997 Michael Shalayeff
···1818 * 4. The name of the author may not be used to endorse or promote products
1919 * derived from this software without specific prior written permission.
2020 *
2121- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
2222- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
2121+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
2222+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
2323 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2424 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
2525 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL