summaryrefslogtreecommitdiffstats
path: root/libc/unistd/charclass.h
diff options
context:
space:
mode:
authorNick Kralevich <nnk@google.com>2012-03-21 09:46:46 -0700
committerNick Kralevich <nnk@google.com>2012-03-21 09:53:05 -0700
commitd1860ad8ddccc17c31783d08a518380d0f205702 (patch)
tree89425a30d3aa7ff8ad1e653a20c4414c040f2a56 /libc/unistd/charclass.h
parentaac0dc97a9ad91231fa89878e745548d693366c1 (diff)
downloadbionic-d1860ad8ddccc17c31783d08a518380d0f205702.zip
bionic-d1860ad8ddccc17c31783d08a518380d0f205702.tar.gz
bionic-d1860ad8ddccc17c31783d08a518380d0f205702.tar.bz2
fnmatch.c: Update to version in OpenBSD HEAD
Upgrade fnmatch.c from OpenBSD version 1.13 to 1.16. This is needed primarily to address CVE-2011-0419. This is a straight copy from upstream's version at http://www.openbsd.org/cgi-bin/cvsweb/src/lib/libc/gen/fnmatch.c and incorporates the following changes: Revision 1.16: New fnmatch(3) implementation which is not recursive. Written and provided under BSD licence by William A. Rowe Jr. Originally released in Apache APR-1.4.5. Merged class matching code from r1.14 and PATH_MAX check from r1.15. ok miod millert Revision 1.15: Put a limit on recursion during matching, and reject input of size greater or equal PATH_MAX. Based on similar fix made in NetBSD. ok miod@ millert@ Revision 1.14: POSIX character class support for fnmatch(3) and glob(3). OK deraadt@ Version 1.14 introduced charclasses.h, which we copy unmodified from upstream version 1.1. http://www.openbsd.org/cgi-bin/cvsweb/src/lib/libc/gen/charclass.h Bug: 3435120 Change-Id: I45133468f0c3d439fd10eb087a1c647799f9d25b
Diffstat (limited to 'libc/unistd/charclass.h')
-rw-r--r--libc/unistd/charclass.h29
1 files changed, 29 insertions, 0 deletions
diff --git a/libc/unistd/charclass.h b/libc/unistd/charclass.h
new file mode 100644
index 0000000..5edb2c1
--- /dev/null
+++ b/libc/unistd/charclass.h
@@ -0,0 +1,29 @@
+/*
+ * Public domain, 2008, Todd C. Miller <Todd.Miller@courtesan.com>
+ *
+ * $OpenBSD: charclass.h,v 1.1 2008/10/01 23:04:13 millert Exp $
+ */
+
+/*
+ * POSIX character class support for fnmatch() and glob().
+ */
+static struct cclass {
+ const char *name;
+ int (*isctype)(int);
+} cclasses[] = {
+ { "alnum", isalnum },
+ { "alpha", isalpha },
+ { "blank", isblank },
+ { "cntrl", iscntrl },
+ { "digit", isdigit },
+ { "graph", isgraph },
+ { "lower", islower },
+ { "print", isprint },
+ { "punct", ispunct },
+ { "space", isspace },
+ { "upper", isupper },
+ { "xdigit", isxdigit },
+ { NULL, NULL }
+};
+
+#define NCCLASSES (sizeof(cclasses) / sizeof(cclasses[0]) - 1)