Exploit database

GH-9a017fa45abc7e1f8f6ba6e1285cae54

iplayforsg/cve-2023-51444

GitHubNot listedPoC
Download repository ZIP

Sources for CVE-2023-51444

1 source

Preferred order: Exploit-DB, Metasploit, then GitHub repositories by stars.

Repository files16

Files from this repository share one source choice. Supporting files may cover other vulnerabilities.

community/oseo/oseo-service/src/main/java/org/geoserver/opensearch/eo/response/QuickTemplate.java

Java · 1,394 bytes
/* (c) 2017 Open Source Geospatial Foundation - all rights reserved
 * This code is licensed under the GPL 2.0 license, available at the root
 * application directory.
 */
package org.geoserver.opensearch.eo.response;

import java.util.Map;

/**
 * Simpleton but fast template engine, replaces variables following the "${varName}" syntax into a
 * string. No escaping, no extras, but avoids building lots of strings to do its work and the
 * overhead of template instantiation of a true template engine.
 *
 * @author Andrea Aime - GeoSolutions
 */
class QuickTemplate {

    /** Simple replacement of a set of variables in a string with their values */
    static String replaceVariables(CharSequence template, Map<String, String> variables) {
        StringBuilder sb = new StringBuilder(template);
        for (Map.Entry<String, String> entry : variables.entrySet()) {
            replaceVariable(sb, entry.getKey(), entry.getValue());
        }

        return sb.toString();
    }

    static void replaceVariable(StringBuilder sb, String key, String value) {
        // infinite loop avoidance
        if (key.equals(value)) {
            return;
        }

        // replace with minimum char movement
        int idx = sb.lastIndexOf(key);
        while (idx >= 0) {
            sb.replace(idx, idx + key.length(), value);
            idx = sb.lastIndexOf(key, idx);
        }
    }
}