8000 lib/core-net/client/sort-dns.c:142:13: error: array subscript 1 is outside array bounds of 'const struct lws_dns_sort_t[0:]' · Issue #2537 · warmcat/libwebsockets · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

lib/core-net/client/sort-dns.c:142:13: error: array subscript 1 is outside array bounds of 'const struct lws_dns_sort_t[0:]' #2537

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
robert-scheck opened this issue Jan 15, 2022 · 3 comments

Comments

@robert-scheck
Copy link

Building libwebsockets v4.3.0 (and v4.2.2 with additionally commit 132833a) using Fedora Rawhide (currently 36) fails like this:

In function 'lws_ipv6_unicast_scope',
    inlined from 'lws_sort_dns_dcomp' at /builddir/build/BUILD/libwebsockets-4.3.0/lib/core-net/client/sort-dns.c:409:11,
    inlined from 'lws_sort_dns_compare' at /builddir/build/BUILD/libwebsockets-4.3.0/lib/core-net/client/sort-dns.c:552:9:
/builddir/build/BUILD/libwebsockets-4.3.0/lib/core-net/client/sort-dns.c:142:13: error: array subscript 1 is outside array bounds of 'const struct lws_dns_sort_t[0:]' [-Werror=array-bounds]
  142 |         if (*u == 0xfe80000000000000ull)
      |             ^~
/builddir/build/BUILD/libwebsockets-4.3.0/lib/core-net/client/sort-dns.c: In function 'lws_sort_dns_compare':
/builddir/build/BUILD/libwebsockets-4.3.0/lib/core-net/client/sort-dns.c:547:1: note: at offset 8 into object 'db' of size 8
  547 | lws_sort_dns_compare(const lws_dll2_t *a, const lws_dll2_t *b)
      | ^~~~~~~~~~~~~~~~~~~~
@lws-team
Copy link
Member

Thanks... does this solve it?

diff --git a/lib/core-net/client/sort-dns.c b/lib/core-net/client/sort-dns.c
index c8d668685b..db105c5228 100644
--- a/lib/core-net/client/sort-dns.c
+++ b/lib/core-net/client/sort-dns.c
@@ -406,7 +406,7 @@ lws_sort_dns_dcomp(const lws_dns_sort_t *da, const lws_dns_sort_t *db)
         */
 
        scopea = lws_ipv6_unicast_scope(to_v6_sa(&da->dest));
-       scopeb = lws_ipv6_unicast_scope(to_v6_sa(&db));
+       scopeb = lws_ipv6_unicast_scope(to_v6_sa(&db->dest));
        scope_srca = lws_ipv6_unicast_scope(to_v6_sa(&da->source));
        scope_srcb = lws_ipv6_unicast_scope(to_v6_sa(&db->source));
 

@robert-scheck
Copy link
Author

Yes, this patch works for both releases and lets the builds succeed. Thank you.

lws-team added a commit that referenced this issue Jan 17, 2022
@lws-team
Copy link
Member

Thanks for letting me know... it's pushed on main and v4.3-stable, which is also tagged out with v4.3.1.

lws-team added a commit that referenced this issue Jan 17, 2022
lws-team added a commit that referenced this issue Aug 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants
0