Skip to content

Commit 290a14c

Browse files
lstipakovcron2
authored andcommitted
dco-win: fix broken ASSERT in dco_new_key
Commit e77c343 ("dco_win: In dco_new_key, document size assumptions for the integer casts") has added an ASSERT on key-id, but didn't take into account that key-id 0 is a perfectly valid value and is the first key-id. This essentially broke dco-win. Fix by adjusting ASSERT to >= 0. Change-Id: I3b1243461ec9b6e85897f452f78dc4b05f7e126d Signed-off-by: Lev Stipakov <[email protected]> Acked-by: Frank Lichtenheld <[email protected]> Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1223 Message-Id: <[email protected]> URL: https://sourceforge.net/p/openvpn/mailman/message/59240115/ Signed-off-by: Gert Doering <[email protected]>
1 parent 36a09c8 commit 290a14c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/openvpn/dco_win.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -541,7 +541,7 @@ dco_new_key(dco_context_t *dco, unsigned int peerid, int keyid, dco_key_slot_t s
541541
ZeroMemory(&crypto_data, sizeof(crypto_data));
542542

543543
crypto_data.CipherAlg = dco_get_cipher(ciphername);
544-
ASSERT(keyid > 0 && keyid <= UCHAR_MAX);
544+
ASSERT(keyid >= 0 && keyid <= UCHAR_MAX);
545545
crypto_data.KeyId = (unsigned char)keyid;
546546
crypto_data.PeerId = peerid;
547547
crypto_data.KeySlot = slot;

0 commit comments

Comments
 (0)