Skip to content

Commit

Permalink
adjust boundary check in for_each for non-standard cases (found by afl)
Browse files Browse the repository at this point in the history
  • Loading branch information
msmeissn committed Oct 19, 2024
1 parent 2ba162a commit 6a1a3f9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion camlibs/ptp2/array.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
* #define for_each(PTR, ARRAY) for (typeof(ARRAY.val) PTR = ARRAY.val; PTR != ARRAY.val + ARRAY.len; ++PTR)
*/
#define for_each(TYPE, PTR, ARRAY) \
for (TYPE PTR = ARRAY.val; PTR != ARRAY.val + ARRAY.len; ++PTR)
for (TYPE PTR = ARRAY.val; PTR < ARRAY.val + ARRAY.len; ++PTR)

#define free_array(ARRAY) do { \
free ((ARRAY)->val); \
Expand Down

0 comments on commit 6a1a3f9

Please sign in to comment.