Version fts one more time! This is the most versioned API ever... Bump

fts_level from short to int to avoid a potential DoS.
From Maksymilian Arciemowicz
This commit is contained in:
christos 2009-08-16 19:33:38 +00:00
parent 0c3bb10a56
commit f227975929
8 changed files with 68 additions and 20 deletions

View File

@ -1,4 +1,4 @@
# $NetBSD: md.amd64,v 1.62 2009/08/03 15:59:41 plunky Exp $
# $NetBSD: md.amd64,v 1.63 2009/08/16 19:33:38 christos Exp $
./dev/lms0 base-obsolete obsolete
./dev/mms0 base-obsolete obsolete
./libexec/ld.elf_so-i386 base-sys-shlib compat,pic
@ -64,7 +64,7 @@
./usr/lib/i386/libbz2.so.1 base-compat-shlib compat,pic
./usr/lib/i386/libbz2.so.1.1 base-compat-shlib compat,pic
./usr/lib/i386/libc.so.12 base-compat-shlib compat,pic
./usr/lib/i386/libc.so.12.169 base-compat-shlib compat,pic
./usr/lib/i386/libc.so.12.170 base-compat-shlib compat,pic
./usr/lib/i386/libcom_err.so.6 base-compat-shlib compat,pic,kerberos
./usr/lib/i386/libcom_err.so.6.0 base-compat-shlib compat,pic,kerberos
./usr/lib/i386/libcrypt.so.1 base-compat-shlib compat,pic

View File

@ -1,4 +1,4 @@
# $NetBSD: md.sparc64,v 1.56 2009/08/03 15:59:41 plunky Exp $
# $NetBSD: md.sparc64,v 1.57 2009/08/16 19:33:38 christos Exp $
./libexec/ld.elf_so-sparc base-sysutil-bin compat,pic
./sbin/edlabel base-sysutil-root
./usr/bin/fdformat base-util-bin
@ -63,7 +63,7 @@
./usr/lib/sparc/libbz2.so.1 base-compat-shlib compat,pic
./usr/lib/sparc/libbz2.so.1.1 base-compat-shlib compat,pic
./usr/lib/sparc/libc.so.12 base-compat-shlib compat,pic
./usr/lib/sparc/libc.so.12.169 base-compat-shlib compat,pic
./usr/lib/sparc/libc.so.12.170 base-compat-shlib compat,pic
./usr/lib/sparc/libcom_err.so.6 base-compat-shlib compat,pic
./usr/lib/sparc/libcom_err.so.6.0 base-compat-shlib compat,pic
./usr/lib/sparc/libcrypt.so.1 base-compat-shlib compat,pic

View File

@ -1,4 +1,4 @@
# $NetBSD: shl.mi,v 1.484 2009/08/03 15:59:41 plunky Exp $
# $NetBSD: shl.mi,v 1.485 2009/08/16 19:33:38 christos Exp $
#
# Note: Don't delete entries from here - mark them as "obsolete" instead,
# unless otherwise stated below.
@ -13,7 +13,7 @@
#
# Note: libtermcap and libtermlib are hardlinked and share the same version.
#
./lib/libc.so.12.169 base-sys-shlib dynamicroot
./lib/libc.so.12.170 base-sys-shlib dynamicroot
./lib/libcrypt.so.1.0 base-sys-shlib dynamicroot
./lib/libcrypto.so.6.0 base-crypto-shlib crypto,dynamicroot
./lib/libdevmapper.so.1.0 base-lvm-shlib lvm,dynamicroot
@ -60,7 +60,7 @@
./usr/lib/libbluetooth.so.4.2 base-sys-shlib
./usr/lib/libbsdmalloc.so.0.0 base-sys-shlib
./usr/lib/libbz2.so.1.1 base-sys-shlib
./usr/lib/libc.so.12.169 base-sys-shlib
./usr/lib/libc.so.12.170 base-sys-shlib
./usr/lib/libcom_err.so.6.0 base-krb5-shlib kerberos
./usr/lib/libcrypt.so.1.0 base-sys-shlib
./usr/lib/libcrypto.so.6.0 base-crypto-shlib crypto

View File

@ -1,4 +1,4 @@
/* $NetBSD: fts.h,v 1.18 2009/01/11 03:04:12 christos Exp $ */
/* $NetBSD: fts.h,v 1.19 2009/08/16 19:33:38 christos Exp $ */
/*
* Copyright (c) 1989, 1993
@ -52,6 +52,9 @@
#ifndef __fts_dev_t
#define __fts_dev_t dev_t
#endif
#ifndef __fts_level_t
#define __fts_level_t int
#endif
typedef struct {
struct _ftsent *fts_cur; /* current node */
@ -99,7 +102,7 @@ typedef struct _ftsent {
#define FTS_ROOTPARENTLEVEL -1
#define FTS_ROOTLEVEL 0
short fts_level; /* depth (-1 to N) */
__fts_level_t fts_level; /* depth (-1 to N) */
#define FTS_D 1 /* preorder directory */
#define FTS_DC 2 /* directory that causes cycles */
@ -136,12 +139,12 @@ typedef struct _ftsent {
__BEGIN_DECLS
#ifndef __LIBC12_SOURCE__
FTSENT *fts_children(FTS *, int) __RENAME(__fts_children50);
int fts_close(FTS *) __RENAME(__fts_close50);
FTSENT *fts_children(FTS *, int) __RENAME(__fts_children60);
int fts_close(FTS *) __RENAME(__fts_close60);
FTS *fts_open(char * const *, int,
int (*)(const FTSENT **, const FTSENT **)) __RENAME(__fts_open50);
FTSENT *fts_read(FTS *) __RENAME(__fts_read50);
int fts_set(FTS *, FTSENT *, int) __RENAME(__fts_set50);
int (*)(const FTSENT **, const FTSENT **)) __RENAME(__fts_open60);
FTSENT *fts_read(FTS *) __RENAME(__fts_read60);
int fts_set(FTS *, FTSENT *, int) __RENAME(__fts_set60);
#endif
__END_DECLS

View File

@ -1,4 +1,4 @@
# $NetBSD: Makefile.inc,v 1.11 2009/02/24 18:42:36 christos Exp $
# $NetBSD: Makefile.inc,v 1.12 2009/08/16 19:33:39 christos Exp $
.PATH: ${COMPATDIR}/gen
SRCS+=compat_errlist.c compat_fts.c compat___fts13.c compat___fts30.c \
@ -8,7 +8,7 @@ SRCS+=compat_errlist.c compat_fts.c compat___fts13.c compat___fts30.c \
compat_times.c compat_timezone.c compat_unvis.c compat_utmpx.c \
compat__sys_errlist.c compat__sys_nerr.c compat__sys_siglist.c \
compat_time.c compat_utime.c compat_devname.c compat_alphasort.c \
compat_getpwent.c compat___fts32.c compat_utmp.c
compat_getpwent.c compat___fts32.c compat_utmp.c compat___fts50.c
LIBMINC=-I${LIBCDIR}/../libm/src -DUSE_LIBM
CPPFLAGS.compat_frexp_ieee754.c += ${LIBMINC}

View File

@ -0,0 +1,43 @@
/* $NetBSD: compat___fts50.c,v 1.1 2009/08/16 19:33:39 christos Exp $ */
#include "namespace.h"
#include <sys/cdefs.h>
#include <dirent.h>
#include <sys/stat.h>
#include <sys/time.h>
#define __LIBC12_SOURCE__
__warn_references(__fts_children50,
"warning: reference to compatibility __fts_children50();"
" include <fts.h> for correct reference")
__warn_references(__fts_close50,
"warning: reference to compatibility __fts_close50();"
" include <fts.h> for correct reference")
__warn_references(__fts_open50,
"warning: reference to compatibility __fts_open50();"
" include <fts.h> for correct reference")
__warn_references(__fts_read50,
"warning: reference to compatibility __fts_read50();"
" include <fts.h> for correct reference")
__warn_references(__fts_set50,
"warning: reference to compatibility __fts_set50();"
" include <fts.h> for correct reference")
#define __fts_level_t short
#undef fts_children
#define fts_children __fts_children50
#undef fts_close
#define fts_close __fts_close50
#undef fts_open
#define fts_open __fts_open50
#undef fts_read
#define fts_read __fts_read50
#undef fts_set
#define fts_set __fts_set50
#include <fts.h>
#include <compat/include/fts.h>
#define __FTS_COMPAT_LEVEL
#include "gen/fts.c"

View File

@ -1,4 +1,4 @@
/* $NetBSD: fts.c,v 1.38 2009/02/28 14:34:18 pgoyette Exp $ */
/* $NetBSD: fts.c,v 1.39 2009/08/16 19:33:39 christos Exp $ */
/*-
* Copyright (c) 1990, 1993, 1994
@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)fts.c 8.6 (Berkeley) 8/14/94";
#else
__RCSID("$NetBSD: fts.c,v 1.38 2009/02/28 14:34:18 pgoyette Exp $");
__RCSID("$NetBSD: fts.c,v 1.39 2009/08/16 19:33:39 christos Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@ -726,6 +726,7 @@ fts_build(FTS *sp, int type)
len++;
maxlen = sp->fts_pathlen - len;
#if defined(__FTS_COMPAT_LEVEL)
if (cur->fts_level == SHRT_MAX) {
(void)closedir(dirp);
cur->fts_info = FTS_ERR;
@ -733,6 +734,7 @@ fts_build(FTS *sp, int type)
errno = ENAMETOOLONG;
return (NULL);
}
#endif
level = cur->fts_level + 1;

View File

@ -1,4 +1,4 @@
# $NetBSD: shlib_version,v 1.213 2009/07/20 17:03:37 joerg Exp $
# $NetBSD: shlib_version,v 1.214 2009/08/16 19:33:38 christos Exp $
# Remember to update distrib/sets/lists/base/shl.* when changing
#
# things we wish to do on next major version bump:
@ -35,4 +35,4 @@
# it's insufficient bitwidth to implement all ctype class.
# see isblank's comment in ctype.h.
major=12
minor=169
minor=170