Skip to content

Commit 893a579

Browse files
committed
upstream: Add explicit check for array overflow.
The array is bounded by a NULL sentinel which already prevents this, however since we check the bit vector for overflow Coverity assumes that check is for the devices array and flags it as a potential overflow. Adding this additional check on the array placates CID 896018. ok djm@ deraadt@ OpenBSD-Commit-ID: e92fff41341b38e4206a70655cc9acaaa032ebee
1 parent 90f49a1 commit 893a579

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

auth2-chall.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $OpenBSD: auth2-chall.c,v 1.55 2025/09/29 02:32:15 djm Exp $ */
1+
/* $OpenBSD: auth2-chall.c,v 1.56 2025/09/29 21:37:52 dtucker Exp $ */
22
/*
33
* Copyright (c) 2001 Markus Friedl. All rights reserved.
44
* Copyright (c) 2001 Per Allansson. All rights reserved.
@@ -165,7 +165,8 @@ kbdint_next_device(Authctxt *authctxt, KbdintAuthctxt *kbdintctxt)
165165
if (len == 0)
166166
break;
167167
for (i = 0; devices[i]; i++) {
168-
if (i >= sizeof(kbdintctxt->devices_done) * 8)
168+
if (i >= sizeof(kbdintctxt->devices_done) * 8 ||
169+
i >= sizeof(devices) / sizeof(devices[0]) - 1)
169170
fatal_f("internal error: too may devices");
170171
if ((kbdintctxt->devices_done & (1 << i)) != 0 ||
171172
!auth2_method_allowed(authctxt,

0 commit comments

Comments
 (0)