Change in libosmocore[master]: add osmo_sockaddr_to_str_c(), osmo_sockaddr_to_str_buf2()
Attention is currently required from: pespin. neels has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmocore/+/26608 ) Change subject: add osmo_sockaddr_to_str_c(), osmo_sockaddr_to_str_buf2() ...................................................................... Patch Set 2: (6 comments) Patchset: PS2: the function was defined to return null for short buf. The new version is better, it returns a truncated string and the would-be-required length. File src/socket.c: https://gerrit.osmocom.org/c/libosmocore/+/26608/comment/6efb1de2_9815eff3 PS1, Line 1827: /*! string-format a given osmo_sockaddr address into a user-supplied buffer.
I think you are changing how this function used to worked here, and imho it's unexpected. […] Previously, the function would return NULL in case of errors, just in a specific corner case it didn't. Read the API doc: "or NULL if too short". The C test shows this.
File tests/socket/socket_test.c: https://gerrit.osmocom.org/c/libosmocore/+/26608/comment/4d53c597_41a7e44d PS2, Line 350: OSMO_ASSERT(!strncmp("[::1]:4", result, sizeof(buf))); here for some reason, even though the port number should be 42, the function failed to return NULL. https://gerrit.osmocom.org/c/libosmocore/+/26608/comment/7d6b93bc_a59aebae PS2, Line 350: OSMO_ASSERT(result == NULL); Now this corner case is fixed. https://gerrit.osmocom.org/c/libosmocore/+/26608/comment/877da413_f3e9b34f PS2, Line 357: OSMO_ASSERT(result == NULL); here and https://gerrit.osmocom.org/c/libosmocore/+/26608/comment/5c7fc121_72005a9d PS2, Line 363: OSMO_ASSERT(result == NULL); here it was always verified to return NULL for a short buffer -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/26608 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: I12771bf8a021e6785217b1faad03c09ec1cfef0e Gerrit-Change-Number: 26608 Gerrit-PatchSet: 2 Gerrit-Owner: neels <nhofmeyr@sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge@osmocom.org> Gerrit-Reviewer: lynxis lazus <lynxis@fe80.eu> Gerrit-CC: pespin <pespin@sysmocom.de> Gerrit-Attention: pespin <pespin@sysmocom.de> Gerrit-Comment-Date: Sat, 22 Jan 2022 22:46:20 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: No Comment-In-Reply-To: pespin <pespin@sysmocom.de> Gerrit-MessageType: comment
participants (1)
-
neels