Compare commits

...
Author SHA1 Message Date
Colin Percival 52876b70cd Extend the character set accepted by freebsd-update(8) in file
names in order to allow upgrades to FreeBSD 9.0-RELEASE.

Approved by:	so (cperciva)
Errata Notice:	FreeBSD-EN-12:01.freebsd-update
2012-01-04 23:47:20 +00:00
Colin Percival d7071cce13 Fix a problem whereby a corrupt DNS record can cause named to crash. [11:06]
Add an API for alerting internal libc routines to the presence of
"unsafe" paths post-chroot, and use it in ftpd. [11:07]

Fix a buffer overflow in telnetd. [11:08]

Make pam_ssh ignore unpassphrased keys unless the "nullok" option is
specified. [11:09]

Add sanity checking of service names in pam_start. [11:10]

Approved by:    so (cperciva)
Approved by:    re (bz)
Security:       FreeBSD-SA-11:06.bind
Security:       FreeBSD-SA-11:07.chroot
Security:       FreeBSD-SA-11:08.telnetd
Security:       FreeBSD-SA-11:09.pam_ssh
Security:       FreeBSD-SA-11:10.pam
2011-12-23 15:00:37 +00:00
Colin Percival 52bc579fa2 Fix a bug in UNIX socket handling in the linux emulator which was
exposed by the security fix in FreeBSD-SA-11:05.unix.

Approved by:	so (cperciva)
Approved by:	re (kib)
Security:	Related to FreeBSD-SA-11:05.unix, but not actually
		a security fix.
2011-10-04 19:07:38 +00:00
Bjoern A. Zeeb e7bf24ad0e Fix handling of corrupt compress(1)ed data. [11:04]
Add missing length checks on unix socket addresses. [11:05]

Approved by:	so (cperciva)
Approved by:	re (kensmith)
Security:	FreeBSD-SA-11:04.compress
Security:	CVE-2011-2895 [11:04]
Security:	FreeBSD-SA-11:05.unix
2011-09-28 08:47:17 +00:00
Simon L. B. Nielsen 3d530be3df Fix an off by one which can result in a assertion failure in BIND
related to large RRSIG RRsets and Negative Caching. This can cause
named to crash.

Security:	FreeBSD-SA-11:02.bind
Security:	CVE-2011-1910
Security:	https://www.isc.org/software/bind/advisories/cve-2011-1910
Obtained from:	ISC
Approved by:	so (simon)
2011-05-28 08:44:39 +00:00
Colin Percival c86a3ed652 Fix CIDR parsing bug in mountd ACLs.
Approved by:	so (cperciva)
Security:	FreeBSD-SA-11:01.mountd
2011-04-20 21:00:24 +00:00
Simon L. B. Nielsen cb122a13fc Fix a race condition exists in the OpenSSL TLS server extension code and
a double free in the SSL client ECDH handling code.

Approved by:	so (simon)
Security:	CVE-2010-2939, CVE-2010-3864
Security:	FreeBSD-SA-10:10.openssl
2010-11-29 20:43:06 +00:00
Colin Percival a4c47c73d2 Fix an integer overflow in RLE length parsing when decompressing
corrupt bzip2 data.

Approved by:	so (cperciva)
Security:	FreeBSD-SA-10:08.bzip2
2010-09-20 14:58:08 +00:00
Colin Percival 3e4fe68b17 Correctly copy the M_RDONLY flag when duplicating a reference
to an mbuf external buffer.

Approved by:	so (cperciva)
Approved by:	re (kensmith)
Security:	FreeBSD-SA-10:07.mbuf
2010-07-13 02:45:17 +00:00
Colin Percival 48a2dfb359 Change the current working directory to be inside the jail created by
the jail(8) command. [10:04]

Fix a one-NUL-byte buffer overflow in libopie. [10:05]

Correctly sanity-check a buffer length in nfs mount. [10:06]

Approved by:	so (cperciva)
Approved by:	re (kensmith)
Security:	FreeBSD-SA-10:04.jail
Security:	FreeBSD-SA-10:05.opie
Security:	FreeBSD-SA-10:06.nfsclient
2010-05-27 03:15:04 +00:00
30 changed files with 267 additions and 49 deletions

No files matched your search

+52
View File
@@ -8,6 +8,58 @@ Items affecting the ports and packages system can be found in
/usr/ports/UPDATING. Please read that file before running
portupgrade.
20120104: p10 FreeBSD-EN-12:01.freebsd-update
Extend the character set accepted by freebsd-update(8) in file
names in order to allow upgrades to FreeBSD 9.0-RELEASE.
20111223: p9 FreeBSD-SA-11:06.bind, FreeBSD-SA-11:07.chroot
FreeBSD-SA-11:08.telnetd, FreeBSD-SA-11:09.pam_ssh
FreeBSD-SA-11:10.pam
Fix a problem whereby a corrupt DNS record can cause named to crash.
[11:06]
Add an API for alerting internal libc routines to the presence of
"unsafe" paths post-chroot, and use it in ftpd. [11:07]
Fix a buffer overflow in telnetd. [11:08]
Make pam_ssh ignore unpassphrased keys unless the "nullok" option is
specified. [11:09]
Add sanity checking of service names in pam_start. [11:10]
20111004: p8 FreeBSD-SA-11:05.unix (revised)
Fix a bug in UNIX socket handling in the linux emulator which was
exposed by the security fix in FreeBSD-SA-11:05.unix.
20110928: p7 FreeBSD-SA-11:04.compress, FreeBSD-SA-11:05.unix
Fix handling of corrupt compress(1)ed data. [11:04]
Add missing length checks on unix socket addresses. [11:05]
20110528: p6 FreeBSD-SA-11:02.bind
Fix BIND remote DoS with large RRSIG RRsets and negative
caching.
20110420: p5 FreeBSD-SA-11:01.mountd
Fix CIDR parsing bug in mountd ACLs.
20101129: p4 FreeBSD-SA-10:10.openssl
Fix OpenSSL multiple vulnerabilities.
20100920: p3 FreeBSD-SA-10:08.bzip2
Fix an integer overflow in RLE length parsing when decompressing
corrupt bzip2 data.
20100713: p2 FreeBSD-SA-10:07.mbuf
Correctly copy the M_RDONLY flag when duplicating a reference
to an mbuf external buffer.
20100526: p1 FreeBSD-SA-10:05.opie, FreeBSD-SA-10:06.nfsclient
Fix a one-NUL-byte buffer overflow in libopie. [10:05]
Correctly sanity-check a buffer length in nfs mount. [10:06]
20100323:
FreeBSD 7.3-RELEASE
+8 -11
View File
@@ -1250,11 +1250,9 @@ query_addadditional(void *arg, dns_name_t *name, dns_rdatatype_t qtype) {
goto addname;
if (result == DNS_R_NCACHENXRRSET) {
dns_rdataset_disassociate(rdataset);
/*
* Negative cache entries don't have sigrdatasets.
*/
INSIST(sigrdataset == NULL ||
! dns_rdataset_isassociated(sigrdataset));
if (sigrdataset != NULL &&
dns_rdataset_isassociated(sigrdataset))
dns_rdataset_disassociate(sigrdataset);
}
if (result == ISC_R_SUCCESS) {
mname = NULL;
@@ -1295,8 +1293,9 @@ query_addadditional(void *arg, dns_name_t *name, dns_rdatatype_t qtype) {
goto addname;
if (result == DNS_R_NCACHENXRRSET) {
dns_rdataset_disassociate(rdataset);
INSIST(sigrdataset == NULL ||
! dns_rdataset_isassociated(sigrdataset));
if (sigrdataset != NULL &&
dns_rdataset_isassociated(sigrdataset))
dns_rdataset_disassociate(sigrdataset);
}
if (result == ISC_R_SUCCESS) {
mname = NULL;
@@ -1744,10 +1743,8 @@ query_addadditional2(void *arg, dns_name_t *name, dns_rdatatype_t qtype) {
goto setcache;
if (result == DNS_R_NCACHENXRRSET) {
dns_rdataset_disassociate(rdataset);
/*
* Negative cache entries don't have sigrdatasets.
*/
INSIST(! dns_rdataset_isassociated(sigrdataset));
if (dns_rdataset_isassociated(sigrdataset))
dns_rdataset_disassociate(sigrdataset);
}
if (result == ISC_R_SUCCESS) {
/* Remember the result as a cache */
+1 -1
View File
@@ -160,7 +160,7 @@ dns_ncache_add(dns_message_t *message, dns_db_t *cache, dns_dbnode_t *node,
*/
isc_buffer_availableregion(&buffer,
&r);
if (r.length < 2)
if (r.length < 3)
return (ISC_R_NOSPACE);
isc_buffer_putuint16(&buffer,
rdataset->type);
+5 -2
View File
@@ -244,6 +244,7 @@ typedef struct rdatasetheader {
#define RDATASET_ATTR_IGNORE 0x0004
#define RDATASET_ATTR_RETAIN 0x0008
#define RDATASET_ATTR_NXDOMAIN 0x0010
#define RDATASET_ATTR_NEGATIVE 0x0100
typedef struct acache_cbarg {
dns_rdatasetadditional_t type;
@@ -278,6 +279,8 @@ struct acachectl {
(((header)->attributes & RDATASET_ATTR_RETAIN) != 0)
#define NXDOMAIN(header) \
(((header)->attributes & RDATASET_ATTR_NXDOMAIN) != 0)
#define NEGATIVE(header) \
(((header)->attributes & RDATASET_ATTR_NEGATIVE) != 0)
#define DEFAULT_NODE_LOCK_COUNT 7 /*%< Should be prime. */
#define DEFAULT_CACHE_NODE_LOCK_COUNT 1009 /*%< Should be prime. */
@@ -3656,7 +3659,7 @@ cache_find(dns_db_t *db, dns_name_t *name, dns_dbversion_t *version,
result == DNS_R_NCACHENXRRSET) {
bind_rdataset(search.rbtdb, node, found, search.now,
rdataset);
if (foundsig != NULL)
if (!NEGATIVE(found) && foundsig != NULL)
bind_rdataset(search.rbtdb, node, foundsig, search.now,
sigrdataset);
}
@@ -4242,7 +4245,7 @@ cache_findrdataset(dns_db_t *db, dns_dbnode_t *node, dns_dbversion_t *version,
}
if (found != NULL) {
bind_rdataset(rbtdb, rbtnode, found, now, rdataset);
if (foundsig != NULL)
if (!NEGATIVE(found) && foundsig != NULL)
bind_rdataset(rbtdb, rbtnode, foundsig, now,
sigrdataset);
}
+7
View File
@@ -381,6 +381,13 @@ Int32 BZ2_decompress ( DState* s )
es = -1;
N = 1;
do {
/* Check that N doesn't get too big, so that es doesn't
go negative. The maximum value that can be
RUNA/RUNB encoded is equal to the block size (post
the initial RLE), viz, 900k, so bounding N at 2
million should guard against overflow without
rejecting any legitimate inputs. */
if (N >= 2*1024*1024) RETURN(BZ_DATA_ERROR);
if (nextSym == BZ_RUNA) es = es + (0+1) * N; else
if (nextSym == BZ_RUNB) es = es + (1+1) * N;
N = N * 2;
+7
View File
@@ -285,6 +285,13 @@ openpam_load_chain(pam_handle_t *pamh,
size_t len;
int r;
/* don't allow to escape from policy_path */
if (strchr(service, '/')) {
openpam_log(PAM_LOG_ERROR, "invalid service name: %s",
service);
return (-PAM_SYSTEM_ERR);
}
for (path = openpam_policy_path; *path != NULL; ++path) {
len = strlen(*path);
if ((*path)[len - 1] == '/') {
+1 -3
View File
@@ -141,10 +141,8 @@ int __opiereadrec FUNCTION((opie), struct opie *opie)
if (c = strchr(opie->opie_principal, ':'))
*c = 0;
if (strlen(opie->opie_principal) > OPIE_PRINCIPAL_MAX)
(opie->opie_principal)[OPIE_PRINCIPAL_MAX] = 0;
strcpy(principal, opie->opie_principal);
strlcpy(principal, opie->opie_principal, sizeof(principal));
do {
if ((opie->opie_recstart = ftell(f)) < 0)
+3
View File
@@ -721,6 +721,9 @@ encrypt_keyid(struct key_info *kp, unsigned char *keyid, int len)
int dir = kp->dir;
int ret = 0;
if (len > MAXKEYLEN)
len = MAXKEYLEN;
if (!(ep = (*kp->getcrypt)(*kp->modep))) {
if (len == 0)
return;
@@ -736,6 +736,9 @@ encrypt_keyid(struct key_info *kp, unsigned char *keyid, int len)
int dir = kp->dir;
int ret = 0;
if (len > MAXKEYLEN)
len = MAXKEYLEN;
if (!(ep = (*kp->getcrypt)(*kp->modep))) {
if (len == 0)
return;
+1
View File
@@ -1289,6 +1289,7 @@ int ssl3_get_key_exchange(SSL *s)
s->session->sess_cert->peer_ecdh_tmp=ecdh;
ecdh=NULL;
BN_CTX_free(bn_ctx);
bn_ctx = NULL;
EC_POINT_free(srvr_ecpoint);
srvr_ecpoint = NULL;
}
+1
View File
@@ -494,6 +494,7 @@ int initgroups(const char *, gid_t);
int iruserok(unsigned long, int, const char *, const char *);
int iruserok_sa(const void *, int, int, const char *, const char *);
int issetugid(void);
void __FreeBSD_libc_enter_restricted_mode(void);
char *mkdtemp(char *);
#ifndef _MKNOD_DECLARED
int mknod(const char *, mode_t, dev_t);
+5 -1
View File
@@ -20,9 +20,13 @@ FBSD_1.1 {
FBSD_1.2 {
} FBSD_1.1;
# This version was first added to 10.0-current.
FBSD_1.3 {
} FBSD_1.2;
# This is our private namespace. Any global interfaces that are
# strictly for use only by other FreeBSD applications and libraries
# are listed here. We use a separate namespace so we can write
# simple ABI-checking tools.
FBSDprivate_1.0 {
} FBSD_1.2;
} FBSD_1.3;
+1
View File
@@ -20,6 +20,7 @@ SRCS+= __getosreldate.c __xuname.c \
getpeereid.c getprogname.c getpwent.c getttyent.c \
getusershell.c getvfsbyname.c glob.c \
initgroups.c isatty.c isinf.c isnan.c jrand48.c lcong48.c \
libc_dlopen.c \
lockf.c lrand48.c mrand48.c nftw.c nice.c \
nlist.c nrand48.c opendir.c \
pause.c pmadvise.c popen.c posixshm.c pselect.c \
+4
View File
@@ -345,6 +345,10 @@ FBSD_1.2 {
getpagesizes;
};
FBSD_1.3 {
__FreeBSD_libc_enter_restricted_mode;
};
FBSDprivate_1.0 {
/* needed by thread libraries */
__thr_jtable;
+61
View File
@@ -0,0 +1,61 @@
/*-
* Copyright (c) 2011 Xin Li <delphij@FreeBSD.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (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
* 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
* SUCH DAMAGE.
*
* $FreeBSD$
*/
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#include <dlfcn.h>
#include <stddef.h>
#include <unistd.h>
#include "libc_private.h"
/*
* Whether we want to restrict dlopen()s.
*/
static int __libc_restricted_mode = 0;
void *
libc_dlopen(const char *path, int mode)
{
if (__libc_restricted_mode) {
_rtld_error("Service unavailable -- libc in restricted mode");
return (NULL);
} else
return (dlopen(path, mode));
}
void
__FreeBSD_libc_enter_restricted_mode(void)
{
__libc_restricted_mode = 1;
return;
}
+11
View File
@@ -43,6 +43,17 @@
*/
extern int __isthreaded;
/*
* libc should use libc_dlopen internally, which respects a global
* flag where loading of new shared objects can be restricted.
*/
void *libc_dlopen(const char *, int);
/*
* For dynamic linker.
*/
void _rtld_error(const char *fmt, ...);
/*
* File lock contention is difficult to diagnose without knowing
* where locks were set. Allow a debug library to be built which
+2 -2
View File
@@ -369,7 +369,7 @@ nss_configure(void)
confmod = statbuf.st_mtime;
#ifdef NS_CACHING
handle = dlopen(NULL, RTLD_LAZY | RTLD_GLOBAL);
handle = libc_dlopen(NULL, RTLD_LAZY | RTLD_GLOBAL);
if (handle != NULL) {
nss_cache_cycle_prevention_func = dlsym(handle,
"_nss_cache_cycle_prevention_function");
@@ -482,7 +482,7 @@ nss_load_module(const char *source, nss_module_register_fn reg_fn)
if (snprintf(buf, sizeof(buf), "nss_%s.so.%d", mod.name,
NSS_MODULE_INTERFACE_VERSION) >= (int)sizeof(buf))
goto fin;
mod.handle = dlopen(buf, RTLD_LOCAL|RTLD_LAZY);
mod.handle = libc_dlopen(buf, RTLD_LOCAL|RTLD_LAZY);
if (mod.handle == NULL) {
#ifdef _NSS_DEBUG
/* This gets pretty annoying since the built-in
+8 -1
View File
@@ -107,7 +107,7 @@ This restriction can be removed by setting the
.Va vfs.usermount
.Xr sysctl 8
variable
to a non-zero value.
to a non-zero value; see the BUGS section for more information.
.Pp
The following
.Fa flags
@@ -370,3 +370,10 @@ functions appeared in
.At v6 .
.Sh BUGS
Some of the error codes need translation to more obvious messages.
.Pp
Allowing untrusted users to mount arbitrary media, e.g. by enabling
.Va vfs.usermount ,
should not be considered safe.
Most file systems in
.Fx
were not built to safeguard against malicious devices.
+18 -7
View File
@@ -88,7 +88,8 @@ static char *const pam_ssh_agent_envp[] = { NULL };
* struct pam_ssh_key containing the key and its comment.
*/
static struct pam_ssh_key *
pam_ssh_load_key(const char *dir, const char *kfn, const char *passphrase)
pam_ssh_load_key(const char *dir, const char *kfn, const char *passphrase,
int nullok)
{
struct pam_ssh_key *psk;
char fn[PATH_MAX];
@@ -98,7 +99,21 @@ pam_ssh_load_key(const char *dir, const char *kfn, const char *passphrase)
if (snprintf(fn, sizeof(fn), "%s/%s", dir, kfn) > (int)sizeof(fn))
return (NULL);
comment = NULL;
key = key_load_private(fn, passphrase, &comment);
/*
* If the key is unencrypted, OpenSSL ignores the passphrase, so
* it will seem like the user typed in the right one. This allows
* a user to circumvent nullok by providing a dummy passphrase.
* Verify that the key really *is* encrypted by trying to load it
* with an empty passphrase, and if the key is not encrypted,
* accept only an empty passphrase.
*/
key = key_load_private(fn, NULL, &comment);
if (key != NULL && !(*passphrase == '\0' && nullok)) {
key_free(key);
return (NULL);
}
if (key == NULL)
key = key_load_private(fn, passphrase, &comment);
if (key == NULL) {
openpam_log(PAM_LOG_DEBUG, "failed to load key from %s\n", fn);
return (NULL);
@@ -165,9 +180,6 @@ pam_sm_authenticate(pam_handle_t *pamh, int flags __unused,
if (pam_err != PAM_SUCCESS)
return (pam_err);
if (*passphrase == '\0' && !nullok)
goto skip_keys;
/* switch to user credentials */
pam_err = openpam_borrow_cred(pamh, pwd);
if (pam_err != PAM_SUCCESS)
@@ -175,7 +187,7 @@ pam_sm_authenticate(pam_handle_t *pamh, int flags __unused,
/* try to load keys from all keyfiles we know of */
for (kfn = pam_ssh_keyfiles; *kfn != NULL; ++kfn) {
psk = pam_ssh_load_key(pwd->pw_dir, *kfn, passphrase);
psk = pam_ssh_load_key(pwd->pw_dir, *kfn, passphrase, nullok);
if (psk != NULL) {
pam_set_data(pamh, *kfn, psk, pam_ssh_free_key);
++nkeys;
@@ -185,7 +197,6 @@ pam_sm_authenticate(pam_handle_t *pamh, int flags __unused,
/* switch back to arbitrator credentials */
openpam_restore_cred(pamh);
skip_keys:
/*
* If we tried an old token and didn't get anything, and
* try_first_pass was specified, try again after prompting the
+1
View File
@@ -1546,6 +1546,7 @@ skip:
reply(550, "Can't change root.");
goto bad;
}
__FreeBSD_libc_enter_restricted_mode();
} else /* real user w/o chroot */
homedir = pw->pw_dir;
/*
+3
View File
@@ -142,6 +142,9 @@ ftpd_popen(char *program, char *type)
}
(void)close(pdes[1]);
}
/* Drop privileges before proceeding */
if (getuid() != geteuid() && setuid(geteuid()) < 0)
_exit(1);
if (strcmp(gargv[0], _PATH_LS) == 0) {
/* Reset getopt for ls_main() */
optreset = optind = optopt = 1;
+15
View File
@@ -101,6 +101,7 @@ do_sa_get(struct sockaddr **sap, const struct osockaddr *osa, int *osalen,
int oldv6size;
struct sockaddr_in6 *sin6;
#endif
int namelen;
if (*osalen < 2 || *osalen > UCHAR_MAX || !osa)
return (EINVAL);
@@ -158,6 +159,20 @@ do_sa_get(struct sockaddr **sap, const struct osockaddr *osa, int *osalen,
if (bdom == AF_INET)
alloclen = sizeof(struct sockaddr_in);
if ((bdom == AF_LOCAL) && (*osalen > sizeof(struct sockaddr_un))) {
for (namelen = 0;
namelen < *osalen - offsetof(struct sockaddr_un, sun_path);
namelen++)
if (!((struct sockaddr_un *)kosa)->sun_path[namelen])
break;
if (namelen + offsetof(struct sockaddr_un, sun_path) >
sizeof(struct sockaddr_un)) {
error = EINVAL;
goto out;
}
alloclen = sizeof(struct sockaddr_un);
}
sa = (struct sockaddr *) kosa;
sa->sa_family = bdom;
sa->sa_len = alloclen;
+1 -1
View File
@@ -32,7 +32,7 @@
TYPE="FreeBSD"
REVISION="7.3"
BRANCH="RELEASE"
BRANCH="RELEASE-p10"
if [ "X${BRANCH_OVERRIDE}" != "X" ]; then
BRANCH=${BRANCH_OVERRIDE}
fi
+1
View File
@@ -301,6 +301,7 @@ mb_dupcl(struct mbuf *n, struct mbuf *m)
n->m_ext.ref_cnt = m->m_ext.ref_cnt;
n->m_ext.ext_type = m->m_ext.ext_type;
n->m_flags |= M_EXT;
n->m_flags |= m->m_flags & M_RDONLY;
}
/*
+4
View File
@@ -395,6 +395,8 @@ uipc_bind(struct socket *so, struct sockaddr *nam, struct thread *td)
unp = sotounpcb(so);
KASSERT(unp != NULL, ("uipc_bind: unp == NULL"));
if (soun->sun_len > sizeof(struct sockaddr_un))
return (EINVAL);
namelen = soun->sun_len - offsetof(struct sockaddr_un, sun_path);
if (namelen <= 0)
return (EINVAL);
@@ -1141,6 +1143,8 @@ unp_connect(struct socket *so, struct sockaddr *nam, struct thread *td)
unp = sotounpcb(so);
KASSERT(unp != NULL, ("unp_connect: unp == NULL"));
if (nam->sa_len > sizeof(struct sockaddr_un))
return (EINVAL);
len = nam->sa_len - offsetof(struct sockaddr_un, sun_path);
if (len <= 0)
return (EINVAL);
+5
View File
@@ -1002,6 +1002,11 @@ nfs_mount(struct mount *mp, struct thread *td)
nfs_decode_args(mp, nmp, &args, NULL);
goto out;
}
if (args.fhsize < 0 || args.fhsize > NFSX_V3FHMAX) {
vfs_mount_error(mp, "Bad file handle");
error = EINVAL;
goto out;
}
/*
* Make the nfs_ip_paranoia sysctl serve as the default connection
+17 -6
View File
@@ -490,7 +490,7 @@ zread(void *cookie, char *rbp, int num)
block_compress = maxbits & BLOCK_MASK;
maxbits &= BIT_MASK;
maxmaxcode = 1L << maxbits;
if (maxbits > BITS) {
if (maxbits > BITS || maxbits < 12) {
errno = EFTYPE;
return (-1);
}
@@ -517,17 +517,28 @@ zread(void *cookie, char *rbp, int num)
for (code = 255; code >= 0; code--)
tab_prefixof(code) = 0;
clear_flg = 1;
free_ent = FIRST - 1;
if ((code = getcode(zs)) == -1) /* O, untimely death! */
break;
free_ent = FIRST;
oldcode = -1;
continue;
}
incode = code;
/* Special case for KwKwK string. */
/* Special case for kWkWk string. */
if (code >= free_ent) {
if (code > free_ent || oldcode == -1) {
/* Bad stream. */
errno = EINVAL;
return (-1);
}
*stackp++ = finchar;
code = oldcode;
}
/*
* The above condition ensures that code < free_ent.
* The construction of tab_prefixof in turn guarantees that
* each iteration decreases code and therefore stack usage is
* bound by 1 << BITS - 256.
*/
/* Generate output characters in reverse order. */
while (code >= 256) {
@@ -544,7 +555,7 @@ middle: do {
} while (stackp > de_stack);
/* Generate the new entry. */
if ((code = free_ent) < maxmaxcode) {
if ((code = free_ent) < maxmaxcode && oldcode != -1) {
tab_prefixof(code) = (u_short) oldcode;
tab_suffixof(code) = finchar;
free_ent = code + 1;
+19 -12
View File
@@ -247,7 +247,7 @@ zread(void *cookie, char *rbp, int num)
zs->zs_block_compress = zs->zs_maxbits & BLOCK_MASK;
zs->zs_maxbits &= BIT_MASK;
zs->zs_maxmaxcode = 1L << zs->zs_maxbits;
if (zs->zs_maxbits > BITS) {
if (zs->zs_maxbits > BITS || zs->zs_maxbits < 12) {
errno = EFTYPE;
return (-1);
}
@@ -259,13 +259,7 @@ zread(void *cookie, char *rbp, int num)
}
zs->zs_free_ent = zs->zs_block_compress ? FIRST : 256;
zs->u.r.zs_finchar = zs->u.r.zs_oldcode = getcode(zs);
if (zs->u.r.zs_oldcode == -1) /* EOF already? */
return (0); /* Get out of here */
/* First code must be 8 bits = char. */
*bp++ = (u_char)zs->u.r.zs_finchar;
count--;
zs->u.r.zs_oldcode = -1;
zs->u.r.zs_stackp = de_stack;
while ((zs->u.r.zs_code = getcode(zs)) > -1) {
@@ -275,17 +269,29 @@ zread(void *cookie, char *rbp, int num)
zs->u.r.zs_code--)
tab_prefixof(zs->u.r.zs_code) = 0;
zs->zs_clear_flg = 1;
zs->zs_free_ent = FIRST - 1;
if ((zs->u.r.zs_code = getcode(zs)) == -1) /* O, untimely death! */
break;
zs->zs_free_ent = FIRST;
zs->u.r.zs_oldcode = -1;
continue;
}
zs->u.r.zs_incode = zs->u.r.zs_code;
/* Special case for KwKwK string. */
if (zs->u.r.zs_code >= zs->zs_free_ent) {
if (zs->u.r.zs_code > zs->zs_free_ent ||
zs->u.r.zs_oldcode == -1) {
/* Bad stream. */
errno = EINVAL;
return (-1);
}
*zs->u.r.zs_stackp++ = zs->u.r.zs_finchar;
zs->u.r.zs_code = zs->u.r.zs_oldcode;
}
/*
* The above condition ensures that code < free_ent.
* The construction of tab_prefixof in turn guarantees that
* each iteration decreases code and therefore stack usage is
* bound by 1 << BITS - 256.
*/
/* Generate output characters in reverse order. */
while (zs->u.r.zs_code >= 256) {
@@ -302,7 +308,8 @@ middle: do {
} while (zs->u.r.zs_stackp > de_stack);
/* Generate the new entry. */
if ((zs->u.r.zs_code = zs->zs_free_ent) < zs->zs_maxmaxcode) {
if ((zs->u.r.zs_code = zs->zs_free_ent) < zs->zs_maxmaxcode &&
zs->u.r.zs_oldcode != -1) {
tab_prefixof(zs->u.r.zs_code) = (u_short) zs->u.r.zs_oldcode;
tab_suffixof(zs->u.r.zs_code) = zs->u.r.zs_finchar;
zs->zs_free_ent = zs->u.r.zs_code + 1;
+1 -1
View File
@@ -1110,7 +1110,7 @@ fetch_metadata_sanity () {
# Some aliases to save space later: ${P} is a character which can
# appear in a path; ${M} is the four numeric metadata fields; and
# ${H} is a sha256 hash.
P="[-+./:=_[[:alnum:]]"
P="[-+./:=%@_[[:alnum:]]"
M="[0-9]+\|[0-9]+\|[0-9]+\|[0-9]+"
H="[0-9a-f]{64}"
+1 -1
View File
@@ -2676,7 +2676,7 @@ makemask(struct sockaddr_storage *ssp, int bitlen)
for (i = 0; i < len; i++) {
bits = (bitlen > CHAR_BIT) ? CHAR_BIT : bitlen;
*p++ = (1 << bits) - 1;
*p++ = (u_char)~0 << (CHAR_BIT - bits);
bitlen -= bits;
}
return 0;