Sync code with last security fixes and improvements from OpenBSD

This commit is contained in:
purplerain 2023-04-30 19:16:28 +00:00
parent 95114fbda2
commit f5f0d5c82b
Signed by: purplerain
GPG key ID: F42C07F07E2E35B7
106 changed files with 371 additions and 1162 deletions

View file

@ -5,7 +5,7 @@
* -
* Copyright (c) 1983, 1993
* The Regents of the University of California. All rights reserved.
*
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@ -17,7 +17,7 @@
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@ -31,14 +31,14 @@
* SUCH DAMAGE.
* -
* Portions Copyright (c) 1993 by Digital Equipment Corporation.
*
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies, and that
* the name of Digital Equipment Corporation not be used in advertising or
* publicity pertaining to distribution of the document or software without
* specific, written prior permission.
*
*
* THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT

View file

@ -5,7 +5,7 @@
* -
* Copyright (c) 1983, 1989, 1993
* The Regents of the University of California. All rights reserved.
*
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@ -17,7 +17,7 @@
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@ -31,14 +31,14 @@
* SUCH DAMAGE.
* -
* Portions Copyright (c) 1993 by Digital Equipment Corporation.
*
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies, and that
* the name of Digital Equipment Corporation not be used in advertising or
* publicity pertaining to distribution of the document or software without
* specific, written prior permission.
*
*
* THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT
@ -231,7 +231,7 @@
#define KEYFLAG_RESERVED_BITMASK ( KEYFLAG_RESERVED3 | \
KEYFLAG_RESERVED4 | \
KEYFLAG_RESERVED10| KEYFLAG_RESERVED11)
KEYFLAG_RESERVED10| KEYFLAG_RESERVED11)
/* The Algorithm field of the KEY and SIG RR's is an integer, {1..254} */
#define ALGORITHM_MD5RSA 1 /* MD5 with RSA */

View file

@ -80,7 +80,7 @@ void auth_setenv(auth_session_t *);
void auth_clrenv(auth_session_t *);
void auth_setstate(auth_session_t *, int);
int auth_call(auth_session_t *, char *, ...)
int auth_call(auth_session_t *, char *, ...)
__attribute__((__sentinel__));
int auth_setdata(auth_session_t *, void *, size_t);

View file

@ -37,7 +37,7 @@
#define I _Complex_I
__BEGIN_DECLS
/*
/*
* Double versions of C99 functions
*/
double complex cacos(double complex);
@ -63,7 +63,7 @@ double complex conj(double complex);
double complex cproj(double complex);
double creal(double complex);
/*
/*
* Float versions of C99 functions
*/
float complex cacosf(float complex);
@ -89,7 +89,7 @@ float complex conjf(float complex);
float complex cprojf(float complex);
float crealf(float complex);
/*
/*
* Long double versions of C99 functions
*/
long double complex cacosl(long double complex);

View file

@ -53,7 +53,7 @@
#define C_ISCTG 0110000
#define C_ISLNK 0120000
#define C_ISSOCK 0140000
#define MAGIC "070707"
#endif /* _CPIO_H_ */

View file

@ -148,11 +148,11 @@ typedef struct {
unsigned int cachesize; /* bytes to cache */
unsigned int psize; /* page size */
int lorder; /* byte order */
size_t reclen; /* record length
size_t reclen; /* record length
(fixed-length records) */
unsigned char bval; /* delimiting byte
unsigned char bval; /* delimiting byte
(variable-length records) */
char *bfname; /* btree file name */
char *bfname; /* btree file name */
} RECNOINFO;
__BEGIN_DECLS

View file

@ -47,7 +47,7 @@
#endif
/*
* The kernel defines the format of directory entries returned by
* The kernel defines the format of directory entries returned by
* the getdents(2) system call.
*/
#include <sys/dirent.h>

View file

@ -72,5 +72,5 @@ extern int optopt;
extern int optreset;
#endif
__END_DECLS
#endif /* !_GETOPT_H_ */

View file

@ -63,7 +63,7 @@ typedef struct {
* and lstat(2).
*/
void (*gl_closedir)(void *);
struct dirent *(*gl_readdir)(void *);
struct dirent *(*gl_readdir)(void *);
void *(*gl_opendir)(const char *);
int (*gl_lstat)(const char *, struct stat *);
int (*gl_stat)(const char *, struct stat *);

View file

@ -1,6 +1,6 @@
/* $OpenBSD: ieeefp.h,v 1.4 2009/09/27 21:23:55 martynas Exp $ */
/*
/*
* Written by J.T. Conklin, Apr 6, 1995
* Public domain.
*/

View file

@ -1,7 +1,7 @@
/* $OpenBSD: iso646.h,v 1.3 2001/10/11 00:05:21 espie Exp $ */
/* $NetBSD: iso646.h,v 1.1 1995/02/17 09:08:10 jtc Exp $ */
/*
/*
* Written by J.T. Conklin <jtc@wimsey.com> 02/16/95.
* Public domain.
*/

View file

@ -5,7 +5,7 @@
*
* Developed at SunPro, a Sun Microsystems, Inc. business.
* Permission to use, copy, modify, and distribute this
* software is freely granted, provided that this notice
* software is freely granted, provided that this notice
* is preserved.
* ====================================================
*/

View file

@ -210,7 +210,7 @@ struct addrinfo {
char *ai_canonname; /* canonical name for service location (iff req) */
struct addrinfo *ai_next; /* pointer to next in list */
};
#if __BSD_VISIBLE
/*
* Flags for getrrsetbyname()

View file

@ -3,7 +3,7 @@
/*
* Written by Theo de Raadt, Public Domain
*
* Typical poll() implementations expect poll.h to be in /usr/include.
* Typical poll() implementations expect poll.h to be in /usr/include.
* However this is not a convenient place for the real definitions.
*/
#include <sys/poll.h>

View file

@ -83,11 +83,11 @@ typedef struct {
typedef struct {
unsigned char vers; /* protocol version */
unsigned char type; /* type of request message, see below */
unsigned char answer; /* response to request message,
unsigned char answer; /* response to request message,
see below */
unsigned char pad;
u_int32_t id_num; /* message id */
struct osockaddr addr; /* address for establishing
struct osockaddr addr; /* address for establishing
conversation */
} CTL_RESPONSE;

View file

@ -58,14 +58,14 @@ struct tsp {
#define tsp_time tsp_u.tspu_time
#define tsp_hopcnt tsp_u.tspu_hopcnt
/*
* Command types.
*/
#define TSP_ANY 0 /* match any types */
#define TSP_ADJTIME 1 /* send adjtime */
#define TSP_ACK 2 /* generic acknowledgement */
#define TSP_MASTERREQ 3 /* ask for master's name */
#define TSP_MASTERREQ 3 /* ask for master's name */
#define TSP_MASTERACK 4 /* acknowledge master request */
#define TSP_SETTIME 5 /* send network time */
#define TSP_MASTERUP 6 /* inform slaves that master is up */
@ -92,8 +92,8 @@ struct tsp {
#ifdef TSPTYPES
char *tsptype[TSPTYPENUMBER] =
{ "ANY", "ADJTIME", "ACK", "MASTERREQ", "MASTERACK", "SETTIME", "MASTERUP",
"SLAVEUP", "ELECTION", "ACCEPT", "REFUSE", "CONFLICT", "RESOLVE", "QUIT",
{ "ANY", "ADJTIME", "ACK", "MASTERREQ", "MASTERACK", "SETTIME", "MASTERUP",
"SLAVEUP", "ELECTION", "ACCEPT", "REFUSE", "CONFLICT", "RESOLVE", "QUIT",
"DATE", "DATEREQ", "DATEACK", "TRACEON", "TRACEOFF", "MSITE", "MSITEREQ",
"TEST", "SETDATE", "SETDATEREQ", "LOOP" };
#endif

View file

@ -16,20 +16,20 @@
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by Chris Provenzano.
* 4. The name of Chris Provenzano may not be used to endorse or promote
* 4. The name of Chris Provenzano may not be used to endorse or promote
* products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY CHRIS PROVENZANO ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL CHRIS PROVENZANO BE LIABLE FOR ANY
* ARE DISCLAIMED. IN NO EVENT SHALL CHRIS PROVENZANO BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $FreeBSD: pthread.h,v 1.13 1999/07/31 08:36:07 rse Exp $
@ -71,7 +71,7 @@
* Flags for read/write lock attributes
*/
#define PTHREAD_PROCESS_PRIVATE 0
#define PTHREAD_PROCESS_SHARED 1
#define PTHREAD_PROCESS_SHARED 1
/*
* Flags for cancelling threads
@ -147,12 +147,12 @@ struct pthread_once {
#define PTHREAD_DONE_INIT 1
/*
* Static once initialization values.
* Static once initialization values.
*/
#define PTHREAD_ONCE_INIT { PTHREAD_NEEDS_INIT, PTHREAD_MUTEX_INITIALIZER }
/*
* Static initialization values.
* Static initialization values.
*/
#define PTHREAD_MUTEX_INITIALIZER NULL
#define PTHREAD_COND_INITIALIZER NULL

View file

@ -3,7 +3,7 @@
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
* All rights reserved.
*
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@ -15,7 +15,7 @@
* 3. Neither the name of the project nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
*
* THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@ -34,7 +34,7 @@
* -
* Copyright (c) 1983, 1987, 1989, 1993
* The Regents of the University of California. All rights reserved.
*
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@ -46,7 +46,7 @@
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@ -60,14 +60,14 @@
* SUCH DAMAGE.
* -
* Portions Copyright (c) 1993 by Digital Equipment Corporation.
*
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies, and that
* the name of Digital Equipment Corporation not be used in advertising or
* publicity pertaining to distribution of the document or software without
* specific, written prior permission.
*
*
* THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT
@ -282,7 +282,7 @@ int res_dnok(const char *);
const char * sym_ntos(const struct res_sym *, int, int *);
int b64_ntop(unsigned char const *, size_t, char *, size_t);
int b64_pton(char const *, unsigned char *, size_t);
int dn_skipname(const unsigned char *,
int dn_skipname(const unsigned char *,
const unsigned char *);
void putlong(u_int32_t, unsigned char *);
void putshort(u_int16_t, unsigned char *);
@ -290,7 +290,7 @@ const char * p_class(int);
const char * p_type(int);
int dn_comp(const char *, unsigned char *, int,
unsigned char **, unsigned char **);
int dn_expand(const unsigned char *, const unsigned char *,
int dn_expand(const unsigned char *, const unsigned char *,
const unsigned char *, char *, int);
int res_init(void);
unsigned int res_randomid(void);
@ -301,12 +301,12 @@ int res_search(const char *, int, int, unsigned char *, int)
int res_querydomain(const char *, const char *, int, int,
unsigned char *, int)
__attribute__((__bounded__(__string__,5,6)));
int res_mkquery(int, const char *, int, int,
const unsigned char *, int, const unsigned char *,
int res_mkquery(int, const char *, int, int,
const unsigned char *, int, const unsigned char *,
unsigned char *, int)
__attribute__((__bounded__(__string__,5,6)))
__attribute__((__bounded__(__string__,8,9)));
int res_send(const unsigned char *, int, unsigned char *,
int res_send(const unsigned char *, int, unsigned char *,
int)
__attribute__((__bounded__(__string__,3,4)));
__END_DECLS

View file

@ -49,7 +49,7 @@ void *tdelete(const void * __restrict, void ** __restrict,
int (*)(const void *, const void *));
void *tfind(const void *, void * const *,
int (*)(const void *, const void *));
void *tsearch(const void *, void **,
void *tsearch(const void *, void **,
int (*)(const void *, const void *));
void twalk(const void *, void (*)(const void *, VISIT, int));
__END_DECLS

View file

@ -3,7 +3,7 @@
/*
* FILE: sha2.h
* AUTHOR: Aaron D. Gifford <me@aarongifford.com>
*
*
* Copyright (c) 2000-2001, Aaron D. Gifford
* All rights reserved.
*
@ -18,7 +18,7 @@
* 3. Neither the name of the copyright holder nor the names of contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTOR(S) ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE

View file

@ -6,7 +6,7 @@
*/
#ifndef _STDBOOL_H_
#define _STDBOOL_H_
#define _STDBOOL_H_
#ifndef __cplusplus

View file

@ -384,7 +384,7 @@ int __swbuf(int, FILE *);
__END_DECLS
/*
* The __sfoo macros are here so that we can
* The __sfoo macros are here so that we can
* define function versions in the C library.
*/
#define __sgetc(p) (--(p)->_r < 0 ? __srget(p) : (int)(*(p)->_p++))

View file

@ -132,7 +132,7 @@ void strmode(int, char *);
char *strsep(char **, const char *);
int timingsafe_bcmp(const void *, const void *, size_t);
int timingsafe_memcmp(const void *, const void *, size_t);
#endif
#endif
__END_DECLS
#endif /* _STRING_H_ */

View file

@ -329,10 +329,10 @@ int chown(const char *, uid_t, gid_t);
int close(int);
int dup(int);
int dup2(int, int);
int execl(const char *, const char *, ...)
int execl(const char *, const char *, ...)
__attribute__((__sentinel__));
int execle(const char *, const char *, ...);
int execlp(const char *, const char *, ...)
int execlp(const char *, const char *, ...)
__attribute__((__sentinel__));
int execv(const char *, char *const *);
int execve(const char *, char *const *, char *const *);