if (javascript_search_mpse->find(ptr, end-ptr, search_js_found, false, &mindex) > 0)
{
const char* js_start = ptr + mindex;
- const char* const angle_bracket = (const char*)SnortStrnStr(js_start, end - js_start, ">");
+ const char* const angle_bracket =
+ (const char*)SnortStrnStr(js_start, end - js_start, ">");
if (angle_bracket == nullptr)
break;
if (!type_js)
continue;
- // FIXIT-L need to fix this library so we don't have to cast away const here.
JSNormalizeDecode(js_start, (uint16_t)(end-js_start), (char*)buffer+index,
(uint16_t)(input.length() - index), &ptr, &bytes_copied, &js,
uri_param.iis_unicode ? uri_param.unicode_map : nullptr);
{
if ((ptr < end) && ((input.length() - index) >= (end - ptr)))
{
- memmove_s(buffer + index, input.length() - index, ptr, end - ptr); index += end - ptr;
+ memmove_s(buffer + index, input.length() - index, ptr, end - ptr);
+ index += end - ptr;
}
if (js.alerts)
{
port.set(STAT_NO_SOURCE);
return;
}
- int32_t host_len;
- for (host_len = 0; (host_len < authority.length()) && (authority.start()[host_len] != ':');
+
+ int32_t host_len = 0;
+
+ // IPv6 addresses are surrounded by [] to protect embedded colons
+ if (authority.start()[0] == '[')
+ {
+ for (; (host_len < authority.length()) && (authority.start()[host_len] != ']');
+ host_len++);
+ }
+
+ for (; (host_len < authority.length()) && (authority.start()[host_len] != ':');
host_len++);
host.set(host_len, authority.start());
if (host.length() < authority.length())