[augeas-devel] [PATCH] Fix buffer overflow on strings ending in \ (regexp.c)
James Antill
james.antill at redhat.com
Wed May 21 18:18:36 UTC 2008
# HG changeset patch
# User james at and.org
# Date 1211393196 14400
# Node ID 8a1ea0e2a3ca69213b9f550749f50dd96a07db97
# Parent 47dc1f2f95254368d46277b295b66349dba2718b
Fix buffer overflow on strings ending in \
diff --git a/src/regexp.c b/src/regexp.c
--- a/src/regexp.c
+++ b/src/regexp.c
@@ -75,7 +75,7 @@
CALLOC(pattern, 2*strlen(text)+1);
p = pattern;
for (const char *t = text; *t != '\0'; t++) {
- if (*t == '\\') {
+ if ((*t == '\\') && t[1]) {
*p++ = *t++;
*p++ = *t;
} else if (strchr(".{}[]()+*?", *t) != NULL) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <http://listman.redhat.com/archives/augeas-devel/attachments/20080521/8872d73f/attachment.sig>
More information about the augeas-devel
mailing list