Skip to content

Commit 3e4869d

Browse files
committed
Fixed DNS crash on resolution failure
1 parent 4608265 commit 3e4869d

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

frida/src/hooks/network.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,14 @@ export const setupNetworkHooks = (): void => {
2828
method.implementation = function (hostname: string) {
2929
if (dnsProvider) {
3030
const resolvedHostname = getDns(hostname);
31-
if (isIpAddress(resolvedHostname)) {
31+
if (resolvedHostname === null) {
32+
const UnknownHostException = Java.use(
33+
"java.net.UnknownHostException"
34+
);
35+
throw UnknownHostException.$new(
36+
`DNS resolution failed for ${hostname}`
37+
);
38+
} else if (isIpAddress(resolvedHostname)) {
3239
log(`Creating InetAddress directly for IP ${resolvedHostname}`);
3340
const parts = resolvedHostname.split(".");
3441
const bytes = Java.array(

0 commit comments

Comments
 (0)