Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <87ttddw7nm.fsf@alyssa.is>
Date: Tue, 15 Oct 2024 20:19:41 +0200
From: Alyssa Ross <hi@...ssa.is>
To: libc-coord@...ts.openwall.com
Subject: sscanf("0x", "%x", &out)

This returns 1 with Glibc, and 0 with musl:

sscanf("0x", "%x", &out)

(I'm talking about the return value, not the value of out.)

This causes real world compatibility issues.  This test[1] fails,
because bluetoothctl expects sscanf("0x01", "%2hhx", …) to return 1, and
returns an error if it doesn't[2].

So, what's the right thing to do here?  The C standard is too dense for
me.

[1]: https://github.com/martinpitt/python-dbusmock/blob/1ae426c687ee48c92ba1a4e27778f217040d7180/tests/test_bluez5.py#L496
[2]: https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/client/adv_monitor.c?id=32e9d15a60948ad1e912f6660e9dea6d8c5265d1#n454

Download attachment "signature.asc" of type "application/pgp-signature" (833 bytes)

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.