Fix crash on void(0) javascripts.
Some checks failed
CI / ubuntu-latest-html-tests (push) Has been cancelled
CI / ubuntu-latest-no-tls (push) Has been cancelled
CI / ubuntu-latest-mbedtls2 (push) Has been cancelled
CI / ubuntu-latest-openssl-3 (push) Has been cancelled
CI / ubuntu-latest-with-old-std (push) Has been cancelled
CI / ubuntu-20-04-openssl-1-1 (push) Has been cancelled
CI / alpine-mbedtls-3_6_0 (push) Has been cancelled
CI / macOS-13-openssl-1-1 (push) Has been cancelled
CI / macOS-13-openssl-3 (push) Has been cancelled
CI / freebsd-14-openssl-3 (push) Has been cancelled
CI / windows-mbedtls (push) Has been cancelled

This commit is contained in:
2025-08-20 13:14:01 -04:00
parent f6eb2ebf87
commit cc657de8fb

View File

@ -2569,7 +2569,7 @@ static const char* Html_get_javascript_link(DilloHtml *html)
if (dStrnAsciiCasecmp("javascript", Buf.c_str(), 10) == 0) { if (dStrnAsciiCasecmp("javascript", Buf.c_str(), 10) == 0) {
i = strcspn(Buf.c_str(), "'\""); i = strcspn(Buf.c_str(), "'\"");
ch = Buf.at( i ); ch = i == Buf.size() ? '0' : Buf.at( i );
if ((ch == '"' || ch == '\'') && if ((ch == '"' || ch == '\'') &&
(p2 = strchr(Buf.data() + i + 1 , ch))) { (p2 = strchr(Buf.data() + i + 1 , ch))) {
p1 = Buf.data() + i; p1 = Buf.data() + i;