9e8ecfb2f4
Some additional fixes from millert@ sprintf -> snprintf str{cat,cpy} -> strl{cat,cpy} http://marc.theaimsgroup.com/?l=bugtraq&m=105638591907836&w=2 ok naddy@
49 lines
1.5 KiB
Plaintext
49 lines
1.5 KiB
Plaintext
$OpenBSD: patch-gnats_regex_c,v 1.1 2003/08/25 23:35:06 brad Exp $
|
|
--- gnats/regex.c.orig Thu Nov 5 12:54:10 1998
|
|
+++ gnats/regex.c Wed Jul 2 13:23:13 2003
|
|
@@ -1623,11 +1623,12 @@ regex_compile (pattern, size, syntax, bu
|
|
case ')':
|
|
if (syntax & RE_NO_BK_PARENS) goto normal_backslash;
|
|
|
|
- if (COMPILE_STACK_EMPTY)
|
|
+ if (COMPILE_STACK_EMPTY) {
|
|
if (syntax & RE_UNMATCHED_RIGHT_PAREN_ORD)
|
|
goto normal_backslash;
|
|
else
|
|
return REG_ERPAREN;
|
|
+ }
|
|
|
|
handle_close:
|
|
if (fixup_alt_jump)
|
|
@@ -1643,11 +1644,12 @@ regex_compile (pattern, size, syntax, bu
|
|
}
|
|
|
|
/* See similar code for backslashed left paren above. */
|
|
- if (COMPILE_STACK_EMPTY)
|
|
+ if (COMPILE_STACK_EMPTY) {
|
|
if (syntax & RE_UNMATCHED_RIGHT_PAREN_ORD)
|
|
goto normal_char;
|
|
else
|
|
return REG_ERPAREN;
|
|
+ }
|
|
|
|
/* Since we just checked for an empty stack above, this
|
|
``can't happen''. */
|
|
@@ -4903,15 +4905,7 @@ regerror (errcode, preg, errbuf, errbuf_
|
|
msg_size = strlen (msg) + 1; /* Includes the null. */
|
|
|
|
if (errbuf_size != 0)
|
|
- {
|
|
- if (msg_size > errbuf_size)
|
|
- {
|
|
- strncpy (errbuf, msg, errbuf_size - 1);
|
|
- errbuf[errbuf_size - 1] = 0;
|
|
- }
|
|
- else
|
|
- strcpy (errbuf, msg);
|
|
- }
|
|
+ strlcpy (errbuf, msg, errbuf_size);
|
|
|
|
return msg_size;
|
|
}
|