I was looking at the arc4_getbyte() utility function the other day and
I noticed something that struck me as dangerous.
1 uchar
2 arc4_getbyte( void )
3 {
4uchar si, sj;
5
6rs.i++;
7si = rs.s[rs.i];
8rs.j += si;
9sj = rs.s[rs.j];
10 rs.s[rs.i] = sj;
11 rs.s[rs.j] = si;
1
> Or maybe even use % 255 instead of a bitmask. I did not test this which is
> why this isn't a patch.
Oops, it would have to be %256.
signature.asc
Description: PGP signature
___
isync-devel mailing list
isync-devel@lists.sourceforge.net
https://lis
> in fact, it works with any compiler by necessity, as the assignment to char
> variables MUST truncate the result.
>
> the masking in line 12 is necessary, because there is no assignment.
> https://stackoverflow.com/questions/46073295/implicit-type-promotion-rules
> explains the deeper problem.