Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5651ced3 authored by Igor Mammedov's avatar Igor Mammedov Committed by Steve French
Browse files

Fix possible access to undefined memory region.

parent b9a3260f
Loading
Loading
Loading
Loading
+5 −4
Original line number Original line Diff line number Diff line
@@ -134,10 +134,6 @@ dns_resolve_server_name_to_ip(const char *unc, char **ip_addr)
	rkey = request_key(&key_type_dns_resolver, name, "");
	rkey = request_key(&key_type_dns_resolver, name, "");
	if (!IS_ERR(rkey)) {
	if (!IS_ERR(rkey)) {
		data = rkey->payload.data;
		data = rkey->payload.data;
		cFYI(1, ("%s: resolved: %s to %s", __func__,
					rkey->description,
					*ip_addr
				));
	} else {
	} else {
		cERROR(1, ("%s: unable to resolve: %s", __func__, name));
		cERROR(1, ("%s: unable to resolve: %s", __func__, name));
		goto out;
		goto out;
@@ -150,6 +146,11 @@ dns_resolve_server_name_to_ip(const char *unc, char **ip_addr)
		if (*ip_addr) {
		if (*ip_addr) {
			memcpy(*ip_addr, data, len);
			memcpy(*ip_addr, data, len);
			(*ip_addr)[len] = '\0';
			(*ip_addr)[len] = '\0';
			if (!IS_ERR(rkey))
				cFYI(1, ("%s: resolved: %s to %s", __func__,
							name,
							*ip_addr
					));
			rc = 0;
			rc = 0;
		} else {
		} else {
			rc = -ENOMEM;
			rc = -ENOMEM;