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

(-)cache_storage.c (-12 / +46 lines)
Lines 503-523 Link Here
503
            /*
503
            /*
504
             * Check if the identifier is in the querystring and cut it out.
504
             * Check if the identifier is in the querystring and cut it out.
505
             */
505
             */
506
            if (querystring
506
            if (querystring) {
507
                && (param = strstr(querystring, *identifier))
507
                /*
508
                && (*(param + len) == '=')
508
                 * First check if the identifier is at the beginning of the
509
                ) {
509
                 * querystring and followed by a '='
510
                char *amp;
510
                 */
511
511
                if (!strncmp(querystring, *identifier, len)
512
                if (querystring != param) {
512
                    && (*(querystring + len) == '=')) {
513
                    querystring = apr_pstrndup(p, querystring,
513
                    param = querystring;
514
                                               param - querystring);
515
                }
514
                }
516
                else {
515
                else {
517
                    querystring = "";
516
                    char *complete;
517
518
                    /*
519
                     * In order to avoid subkey matching (PR 48401) prepend
520
                     * identifier with a '&' and append a '='
521
                     */
522
                    complete = apr_pstrcat(p, "&", *identifier, "=", NULL);
523
                    param = strstr(querystring, complete);
524
                    /* If we found something we are sitting on the '&' */
525
                    if (param) {
526
                        param++;
527
                    }
518
                }
528
                }
519
                if ((amp = strchr(param + len + 1, '&'))) {
529
                if (param) {
520
                    querystring = apr_pstrcat(p, querystring, amp + 1, NULL);
530
                    char *amp = NULL;
531
                    /* whether the identifier is the first param */
532
                    int is_first_param = 0;
533
                    
534
                    if (querystring != param) {
535
                        /* Do not include the '&' */
536
                        querystring = apr_pstrndup(p, querystring,
537
                                                   param - 1 - querystring);
538
                        /* It is *not* the first param */
539
                        is_first_param = 0;
540
                    }
541
                    else {
542
                        querystring = "";
543
                        /* It is the first param */
544
                        is_first_param = 1;
545
                    }
546
                    
547
                    if (amp = strchr(param + len + 1, '&')) {
548
                        /*
549
                         * If the identifier is the first param,
550
                         * then do not add the '&'
551
                         */
552
                        querystring = apr_pstrcat(p, querystring,
553
                                                  amp + is_first_param, NULL);
554
                    }
521
                }
555
                }
522
                break;
556
                break;
523
            }
557
            }

Return to bug 48401