Attention is currently required from: Arne Schwabe.
Hello Arne Schwabe,
I'd like you to do a code review.
Please visit
https://gerrit.openvpn.net/c/openvpn/+/2397?usp=email
to review the following change.
Change subject: ssl: don't report a missing string length as success
......................................................................
ssl: don't report a missing string length as success
read_string() negated the result of buf_read_u16(), so a length that
couldn't be read (-1) came back as 1, a successful read of an empty
string. A key method 2 message that ended before the options, username
or password was accepted as if they had been sent.
Return -1 when the length can't be read.
Change-Id: I5d5781c81fbea73833a9bd6196c583fa18973a57
Signed-off-by: Razvan Cojocaru <[email protected]>
---
M src/openvpn/ssl.c
1 file changed, 6 insertions(+), 1 deletion(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/97/2397/1
diff --git a/src/openvpn/ssl.c b/src/openvpn/ssl.c
index acdc7e5..024e327 100644
--- a/src/openvpn/ssl.c
+++ b/src/openvpn/ssl.c
@@ -1898,12 +1898,17 @@
* If the message is over the capacity or could not be read
* it will return the negative length that was in the
* header and try to skip the string. If the string cannot be skipped, the
- * buf will stay at the current position or position + 2
+ * buf will stay at the current position or position + 2. If the header
+ * itself cannot be read, -1 is returned.
*/
static int
read_string(struct buffer *buf, char *str, const unsigned int capacity)
{
const int len = buf_read_u16(buf);
+ if (len < 0)
+ {
+ return -1;
+ }
if (len < 1 || len > (int)capacity)
{
buf_advance(buf, len);
--
To view, visit https://gerrit.openvpn.net/c/openvpn/+/2397?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: newchange
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I5d5781c81fbea73833a9bd6196c583fa18973a57
Gerrit-Change-Number: 2397
Gerrit-PatchSet: 1
Gerrit-Owner: Răzvan Cojocaru <[email protected]>
Gerrit-Reviewer: Arne Schwabe <[email protected]>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: Arne Schwabe <[email protected]>
_______________________________________________
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel