Bug 36113

Summary: network/socket.c: Don't take address of a pointer
Product: Sisyphus Reporter: Ivan A. Melnikov <iv>
Component: elinksAssignee: Vladislav Zavjalov <slazav>
Status: CLOSED FIXED QA Contact: qa-sisyphus
Severity: normal    
Priority: P3 CC: at, george, glebfm, slazav
Version: unstable   
Hardware: all   
OS: Linux   

Description Ivan A. Melnikov 2019-02-15 19:08:26 MSK
Build of elinks 0.12-alt0.12.2 failed with the following error when compiling src/network/socket.c:

In function 'check_if_local_address6',
    inlined from 'connect_socket' at socket.c:578:13:
socket.c:404:12: error: '__builtin_memcmp_eq' reading 4 bytes from a region of size 0 [-Werror=stringop-overflow=]
        && !memcmp(&((struct sockaddr_in *) &addr)->sin_addr.s_addr,
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     &((struct sockaddr_in *) ifa->ifa_addr)->sin_addr.s_addr,
     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     sizeof(((struct sockaddr_in *) &addr)->sin_addr.s_addr))) {
     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors


Apparently, `addr` variable here is already a pointer, so we don't need to take its address once agan. With a trivial fix, the compilation completes successfully. Here's the fix:

http://git.altlinux.org/people/iv/packages/elinks.git?p=elinks.git;a=commit;h=f18a0f75ce08aea730b5f7fb8085b3a4a007d768

Please apply it to the next Sisyphus build.
Comment 1 Ivan A. Melnikov 2019-02-15 19:10:29 MSK
It worth pointing out that currently the bug is present in upstream's master branch:

https://repo.or.cz/elinks.git/blob/f86be659718c0cd0a67f88b42f07044c23d0d028:/src/network/socket.c#l408

But I'm not sure how to report it: their bugizilla seems to be down, and their mailing lists info looks outdated.
Comment 2 Ivan A. Melnikov 2019-09-17 10:43:31 MSK
Создан 

task #237667: added #100: build tag "0.12-alt0.12.4" from /people/iv/packages/elinks.git
task #237667: try #1 is AWAITING, result will be emailed to iv@altlinux.org

Отличия от 0.12-alt0.12.3 только в исправлении этого бага:
http://git.altlinux.org/people/iv/packages/elinks.git?p=elinks.git;a=commitdiff;h=8d270d29c8272f81ec2b6fcfbef46327b65d6568
http://git.altlinux.org/people/iv/packages/elinks.git?p=elinks.git;a=commitdiff;h=af298496bc0e97a066896aa92a6b83ffca550e1c
Comment 3 Repository Robot 2019-09-17 15:12:46 MSK
elinks-0.12-alt0.12.4 -> sisyphus:

Tue Sep 17 2019 Ivan A. Melnikov <iv@altlinux> 0.12-alt0.12.4
- fix double dereference (closes: #36113)