View | Details | Raw Unified | Return to bug 55910
Collapse All | Expand All

(-)server/util.c.orig (-7 / +8 lines)
Lines 968-974 Link Here
968
/* Read one line from open ap_configfile_t, strip LF, increase line number */
968
/* Read one line from open ap_configfile_t, strip LF, increase line number */
969
/* If custom handler does not define a getstr() function, read char by char */
969
/* If custom handler does not define a getstr() function, read char by char */
970
static apr_status_t ap_cfg_getline_core(char *buf, apr_size_t bufsize,
970
static apr_status_t ap_cfg_getline_core(char *buf, apr_size_t bufsize,
971
                                        ap_configfile_t *cfp)
971
                                        ap_configfile_t *cfp, int buf_grown)
972
{
972
{
973
    apr_status_t rc;
973
    apr_status_t rc;
974
    /* If a "get string" function is defined, use it */
974
    /* If a "get string" function is defined, use it */
Lines 999-1009 Link Here
999
             */
999
             */
1000
            cp = cbuf;
1000
            cp = cbuf;
1001
            cp += strlen(cp);
1001
            cp += strlen(cp);
1002
            if (cp > cbuf && cp[-1] == LF) {
1002
            if ((buf_grown || cp > cbuf) && cp[-1] == LF) {
1003
                cp--;
1003
                cp--;
1004
                if (cp > cbuf && cp[-1] == CR)
1004
                if ((buf_grown || cp > cbuf) && cp[-1] == CR)
1005
                    cp--;
1005
                    cp--;
1006
                if (cp > cbuf && cp[-1] == '\\') {
1006
                if ((buf_grown || cp > cbuf) && cp[-1] == '\\') {
1007
                    cp--;
1007
                    cp--;
1008
                    /*
1008
                    /*
1009
                     * line continuation requested -
1009
                     * line continuation requested -
Lines 1043-1049 Link Here
1043
            if (c == LF) {
1043
            if (c == LF) {
1044
                ++cfp->line_number;
1044
                ++cfp->line_number;
1045
                /* check for line continuation */
1045
                /* check for line continuation */
1046
                if (i > 0 && buf[i-1] == '\\') {
1046
                if ((buf_grown || i > 0) && buf[i-1] == '\\') {
1047
                    i--;
1047
                    i--;
1048
                    continue;
1048
                    continue;
1049
                }
1049
                }
Lines 1089-1095 Link Here
1089
AP_DECLARE(apr_status_t) ap_cfg_getline(char *buf, apr_size_t bufsize,
1089
AP_DECLARE(apr_status_t) ap_cfg_getline(char *buf, apr_size_t bufsize,
1090
                                        ap_configfile_t *cfp)
1090
                                        ap_configfile_t *cfp)
1091
{
1091
{
1092
    apr_status_t rc = ap_cfg_getline_core(buf, bufsize, cfp);
1092
    apr_status_t rc = ap_cfg_getline_core(buf, bufsize, cfp, 0);
1093
    if (rc == APR_SUCCESS)
1093
    if (rc == APR_SUCCESS)
1094
        cfg_trim_line(buf);
1094
        cfg_trim_line(buf);
1095
    return rc;
1095
    return rc;
Lines 1116-1122 Link Here
1116
    }
1116
    }
1117
1117
1118
    for (;;) {
1118
    for (;;) {
1119
        rc = ap_cfg_getline_core(vb->buf + vb->strlen, vb->avail - vb->strlen, cfp);
1119
        rc = ap_cfg_getline_core(vb->buf + vb->strlen, vb->avail - vb->strlen,
1120
                                 cfp, vb->strlen > 0);
1120
        if (rc == APR_ENOSPC || rc == APR_SUCCESS)
1121
        if (rc == APR_ENOSPC || rc == APR_SUCCESS)
1121
            vb->strlen += strlen(vb->buf + vb->strlen);
1122
            vb->strlen += strlen(vb->buf + vb->strlen);
1122
        if (rc != APR_ENOSPC)
1123
        if (rc != APR_ENOSPC)

Return to bug 55910