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 extra a field from a buffer
......................................................................


Patch Set 6:

(8 comments)

Commit Message:

http://gerrit.openvpn.net/c/openvpn/+/1855/comment/3d741555_2dbdb0cc?usp=email :
PS6, Line 7: Add helper method to extra a field from a buffer
Typo: "extract"


File src/openvpn/buffer.h:

http://gerrit.openvpn.net/c/openvpn/+/1855/comment/a4d6d932_08ee6782?usp=email :
PS6, Line 2247:  * Extract a field from buf that end with the \c sep character. 
The
Typo: "ends".


http://gerrit.openvpn.net/c/openvpn/+/1855/comment/38d87af4_b0194d78?usp=email :
PS6, Line 2255: #endif /* BUFFER_H */
Probably want a newline between the function name and `#endif`.


File src/openvpn/buffer.c:

http://gerrit.openvpn.net/c/openvpn/+/1855/comment/6ddfc3d3_5bd9e116?usp=email :
PS6, Line 1389: extract_field(struct buffer *buf, char sep, struct gc_arena *gc)
Just a nitpick, and possibly wrong but just in case you think it's worth a 
think: most other functions in these files are prefixed with `buf_`. Would 
`buf_extract_field()` make more sense?


http://gerrit.openvpn.net/c/openvpn/+/1855/comment/e48fa955_a2ea0218?usp=email :
PS6, Line 1391:     const uint8_t *seppos = memchr(BPTR(buf), sep, 
buf_len(buf));
`BPTR(buf)` seems capable of returning `NULL`, so should we check we're not 
passing `NULL` to `memchr()` before the call?

Maybe as:

```
if (!buf_valid(buf))
    return NULL;
```


http://gerrit.openvpn.net/c/openvpn/+/1855/comment/78dc6664_ca817865?usp=email :
PS6, Line 1400:     strncpy(field, BSTR(buf), field_len);
We already know the length (don't need to look for `NUL` characters anymore), 
so `memcpy(field, BPTR(buf), field_len);` should be enough here.


http://gerrit.openvpn.net/c/openvpn/+/1855/comment/13cf5451_c9f30ca1?usp=email :
PS6, Line 1403:     buf_advance(buf, (int)field_len + 1);
The `(int)` cast is unnecessary, `buf_advance()` already takes a `size_t` 
parameter there.


http://gerrit.openvpn.net/c/openvpn/+/1855/comment/5ba75d93_7c9f51c5?usp=email :
PS6, Line 1405: }
Minor nitpick: this lost the trailing endline.



--
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: 6
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 12:33:14 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
_______________________________________________
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel

Reply via email to