[M] Change in openvpn[master]: Add helper method to read an integer from a buffer

"razvanc \(Code Review\) via Openvpn-devel" <[email protected]>
Newsgroups gmane.network.openvpn.devel
Message-ID <f397a7679c2efd42302b95a7c070337899f710f5-EmailReviewComments-HTML@gerrit.openvpn.net>
Attention is currently required from: cron2, plaisthos.

razvanc has posted comments on this change by plaisthos. ( http://gerrit.openvpn.net/c/openvpn/+/1855?usp=email )

Change subject: Add helper method to read an integer from a buffer
......................................................................


Patch Set 5:

(2 comments)

Patchset:

PS5: 
> `buf_read_u64()` reads a binary-encoded 8 byte integer, not a decimal-encoded one
OK, what about the `atoi_constrained()` remark? E.g. something like:

```
const char *len_str = extract_field(&buf, ',', &gc);
int payload_len;
if (!len_str
    || !atoi_constrained(len_str, &payload_len, "ACC payload length",
                         0, ACC_MAX_MSG_LEN, D_PUSH_ERRORS))
{
    err_reason = "could not parse payload length field";
    goto err;
}
```


File src/openvpn/buffer.c:

http://gerrit.openvpn.net/c/openvpn/+/1855/comment/e7c9606f_f382f14b?usp=email :
PS5, Line 1400:         if (c >= '0' && c <= '9')
> for explicit integer parsing, the code "as written" with explicit `c >= '0'... […]
Fair enough, can't argue with style preference. 😊



-- 
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1855?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: comment
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ifdd2122a3e60cdb11cc9df67570ab5628bfcdeea
Gerrit-Change-Number: 1855
Gerrit-PatchSet: 5
Gerrit-Owner: plaisthos <[email protected]>
Gerrit-CC: cron2 <[email protected]>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-CC: razvanc <[email protected]>
Gerrit-Attention: plaisthos <[email protected]>
Gerrit-Attention: cron2 <[email protected]>
Gerrit-Comment-Date: Wed, 26 Aug 2026 06:25:30 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: cron2 <[email protected]>
Comment-In-Reply-To: razvanc <[email protected]>

_______________________________________________
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.