Download | Plain Text | No Line Numbers


  1. --- server/util.c.orig 2013-05-28 23:17:53.000000000 +0200
  2. +++ server/util.c 2013-12-19 02:38:44.994088605 +0100
  3. @@ -968,7 +968,7 @@
  4. /* Read one line from open ap_configfile_t, strip LF, increase line number */
  5. /* If custom handler does not define a getstr() function, read char by char */
  6. static apr_status_t ap_cfg_getline_core(char *buf, apr_size_t bufsize,
  7. - ap_configfile_t *cfp)
  8. + ap_configfile_t *cfp, int buf_grown)
  9. {
  10. apr_status_t rc;
  11. /* If a "get string" function is defined, use it */
  12. @@ -999,11 +999,11 @@
  13. */
  14. cp = cbuf;
  15. cp += strlen(cp);
  16. - if (cp > cbuf && cp[-1] == LF) {
  17. + if ((buf_grown || cp > cbuf) && cp[-1] == LF) {
  18. cp--;
  19. - if (cp > cbuf && cp[-1] == CR)
  20. + if ((buf_grown || cp > cbuf) && cp[-1] == CR)
  21. cp--;
  22. - if (cp > cbuf && cp[-1] == '\\') {
  23. + if ((buf_grown || cp > cbuf) && cp[-1] == '\\') {
  24. cp--;
  25. /*
  26. * line continuation requested -
  27. @@ -1043,7 +1043,7 @@
  28. if (c == LF) {
  29. ++cfp->line_number;
  30. /* check for line continuation */
  31. - if (i > 0 && buf[i-1] == '\\') {
  32. + if ((buf_grown || i > 0) && buf[i-1] == '\\') {
  33. i--;
  34. continue;
  35. }
  36. @@ -1089,7 +1089,7 @@
  37. AP_DECLARE(apr_status_t) ap_cfg_getline(char *buf, apr_size_t bufsize,
  38. ap_configfile_t *cfp)
  39. {
  40. - apr_status_t rc = ap_cfg_getline_core(buf, bufsize, cfp);
  41. + apr_status_t rc = ap_cfg_getline_core(buf, bufsize, cfp, 0);
  42. if (rc == APR_SUCCESS)
  43. cfg_trim_line(buf);
  44. return rc;
  45. @@ -1116,7 +1116,8 @@
  46. }
  47.  
  48. for (;;) {
  49. - rc = ap_cfg_getline_core(vb->buf + vb->strlen, vb->avail - vb->strlen, cfp);
  50. + rc = ap_cfg_getline_core(vb->buf + vb->strlen, vb->avail - vb->strlen,
  51. + cfp, vb->strlen > 0);
  52. if (rc == APR_ENOSPC || rc == APR_SUCCESS)
  53. vb->strlen += strlen(vb->buf + vb->strlen);
  54. if (rc != APR_ENOSPC)
  55.