patch-gnats_regex_c 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. $OpenBSD: patch-gnats_regex_c,v 1.2 2007/12/28 17:11:25 espie Exp $
  2. --- gnats/regex.c.orig Thu Nov 5 20:54:10 1998
  3. +++ gnats/regex.c Fri Dec 28 18:00:24 2007
  4. @@ -1623,11 +1623,12 @@ regex_compile (pattern, size, syntax, bufp)
  5. case ')':
  6. if (syntax & RE_NO_BK_PARENS) goto normal_backslash;
  7. - if (COMPILE_STACK_EMPTY)
  8. + if (COMPILE_STACK_EMPTY) {
  9. if (syntax & RE_UNMATCHED_RIGHT_PAREN_ORD)
  10. goto normal_backslash;
  11. else
  12. return REG_ERPAREN;
  13. + }
  14. handle_close:
  15. if (fixup_alt_jump)
  16. @@ -1643,11 +1644,12 @@ regex_compile (pattern, size, syntax, bufp)
  17. }
  18. /* See similar code for backslashed left paren above. */
  19. - if (COMPILE_STACK_EMPTY)
  20. + if (COMPILE_STACK_EMPTY) {
  21. if (syntax & RE_UNMATCHED_RIGHT_PAREN_ORD)
  22. goto normal_char;
  23. else
  24. return REG_ERPAREN;
  25. + }
  26. /* Since we just checked for an empty stack above, this
  27. ``can't happen''. */
  28. @@ -4903,15 +4905,7 @@ regerror (errcode, preg, errbuf, errbuf_size)
  29. msg_size = strlen (msg) + 1; /* Includes the null. */
  30. if (errbuf_size != 0)
  31. - {
  32. - if (msg_size > errbuf_size)
  33. - {
  34. - strncpy (errbuf, msg, errbuf_size - 1);
  35. - errbuf[errbuf_size - 1] = 0;
  36. - }
  37. - else
  38. - strcpy (errbuf, msg);
  39. - }
  40. + strlcpy (errbuf, msg, errbuf_size);
  41. return msg_size;
  42. }