Skip to content

Commit

Permalink
dd: add limit check for count
Browse files Browse the repository at this point in the history
  • Loading branch information
alfredh committed Jul 30, 2024
1 parent f0231f2 commit cce46da
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/dd/putbit.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ int putbit_write(struct putbit *pb, unsigned count, unsigned val)
if (!pb)
return EINVAL;

if (count > 32)
return EINVAL;

for (unsigned i=0; i<count; i++) {

unsigned shift = count-i-1;
Expand Down

0 comments on commit cce46da

Please sign in to comment.