Change in libosmo-netif[master]: osmo-amr-inspect: Improve robustness reading from stdin
4 Jan
2023
4 Jan
'23
7:23 p.m.
Attention is currently required from: fixeria.
pespin has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmo-netif/+/30837 )
Change subject: osmo-amr-inspect: Improve robustness reading from stdin
......................................................................
Patch Set 1:
(1 comment)
File utils/osmo-amr-inspect.c:
https://gerrit.osmocom.org/c/libosmo-netif/+/30837/comment/caf0a34b_99f714ac
PS1, Line 260: sizeof(buf
> Are you sure this is correct? You're asking osmo_hexparse() to parse the whole buffer (2048 bytes), […]
Yes, that was a bug before this change too, see API doc:
"""
/*! Parse a string containing hexadecimal digits
* \param[in] str string containing ASCII encoded hexadecimal digits
* \param[out] b output buffer
* \param[in] max_len maximum space in output buffer
* \returns number of parsed octets, or -1 on error
*/
int osmo_hexparse(const char *str, uint8_t *b, unsigned int max_len)
{
...
for (strpos = str; (c = *strpos); strpos++) {
...
}
"""
So hexparse is reading from hex_buf until finding a null character.
--
To view, visit https://gerrit.osmocom.org/c/libosmo-netif/+/30837
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmo-netif
Gerrit-Branch: master
Gerrit-Change-Id: I460f1deb7455b3b6a85a090bdcad8e21a883db68
Gerrit-Change-Number: 30837
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin@sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy@sysmocom.de>
Gerrit-Reviewer: laforge <laforge@osmocom.org>
Gerrit-Attention: fixeria <vyanitskiy@sysmocom.de>
Gerrit-Comment-Date: Wed, 04 Jan 2023 18:23:25 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: fixeria <vyanitskiy@sysmocom.de>
Gerrit-MessageType: comment
1409
Age (days ago)
1409
Last active (days ago)
0 comments
1 participants
participants (1)
-
pespin