https://bugs.winehq.org/show_bug.cgi?id=45397
Bug ID: 45397 Summary: WSAStringToAddressA recognizes "255.255.255" as a valid IP Product: Wine Version: 3.10 Hardware: x86-64 OS: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: winsock Assignee: wine-bugs@winehq.org Reporter: ansasaki@redhat.com Distribution: ---
Created attachment 61709 --> https://bugs.winehq.org/attachment.cgi?id=61709 Reproducer
When WSAStringToAddressA is called passing "255.255.255" as the input string to be converted, it is successful and returns zero.
Running on Windows instead of wine, it returns an error code, as expected.
This was tested using version wine-3.10 (Staging), packaged on Fedora.
Follows attached a reproducer.
https://bugs.winehq.org/show_bug.cgi?id=45397
Thomas Faller tfaller1@gmx.de changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |tfaller1@gmx.de
--- Comment #1 from Thomas Faller tfaller1@gmx.de --- This is because wine uses "inet_aton" to parse the ip. "inet_aton" acceepts this address because of specific parsing rules. The rules can be found here: https://linux.die.net/man/3/inet_aton
https://bugs.winehq.org/show_bug.cgi?id=45397
Zebediah Figura z.figura12@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |z.figura12@gmail.com
--- Comment #2 from Zebediah Figura z.figura12@gmail.com --- Is there an application that depends on this failing?
https://bugs.winehq.org/show_bug.cgi?id=45397
--- Comment #3 from Anderson Sasaki ansasaki@redhat.com --- (In reply to Zebediah Figura from comment #2)
Is there an application that depends on this failing?
Not an application, but libssh (https://www.libssh.org/) is relying on WSAStringToAddressA to detect valid IP addresses when built for Windows.
So, if an application uses libssh and is run on wine, it would incorrectly accept incomplete IP addresses if the execution is based on the result of the call to ssh_is_ipaddr() (which calls WSAStringToAddressA).
https://bugs.winehq.org/show_bug.cgi?id=45397
--- Comment #4 from Zebediah Figura z.figura12@gmail.com --- In general I don't think we put too much effort into correcting functions that are too lenient, unless an application requires it.
https://bugs.winehq.org/show_bug.cgi?id=45397
--- Comment #5 from Hans Leidekker hans@meelstraat.net --- (In reply to Anderson Sasaki from comment #0)
Created attachment 61709 [details] Reproducer
When WSAStringToAddressA is called passing "255.255.255" as the input string to be converted, it is successful and returns zero.
Running on Windows instead of wine, it returns an error code, as expected.
What version of Windows? Our test suite includes such a test and it accepts both success and failure results, suggesting that behavior may be different across Windows versions. On Windows 10 this test succeeds.
https://bugs.winehq.org/show_bug.cgi?id=45397
Andreas Schneider asn@cryptomilk.org changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |asn@cryptomilk.org
--- Comment #6 from Andreas Schneider asn@cryptomilk.org --- (In reply to Thomas Faller from comment #1)
This is because wine uses "inet_aton" to parse the ip. "inet_aton" acceepts this address because of specific parsing rules. The rules can be found here: https://linux.die.net/man/3/inet_aton
libssh uses inet_pton() on Unix platforms which works correctly!
rc = inet_pton(AF_INET, str, &dest);
Maybe it is a good idea to switch if inet_aton() doesn't work correctly.
https://bugs.winehq.org/show_bug.cgi?id=45397
--- Comment #7 from Gijs Vermeulen gijsvrm@gmail.com --- Is there a valid bug here? I tested this IP on a plethora of Windows versions + Wine and they all seem to succeed for this IP.
See: https://testbot.winehq.org/JobDetails.pl?Key=74796
https://bugs.winehq.org/show_bug.cgi?id=45397
--- Comment #8 from Austin English austinenglish@gmail.com --- (In reply to Gijs Vermeulen from comment #7)
Is there a valid bug here? I tested this IP on a plethora of Windows versions + Wine and they all seem to succeed for this IP.
From comment #3, it sounds like someone needs to test a win32 application using
libssh (a particular known version, in case libssh/application has changed) on wine/different windows versions).
https://bugs.winehq.org/show_bug.cgi?id=45397
--- Comment #9 from Gijs Vermeulen gijsvrm@gmail.com --- (In reply to Austin English from comment #8)
From comment #3, it sounds like someone needs to test a win32 application using libssh (a particular known version, in case libssh/application has changed) on wine/different windows versions).
I'll try and test with the libssh testsuite found here https://git.libssh.org/projects/libssh.git/tree/tests/unittests/torture_isipaddr.c.