avutil/cast5: Fix off by one error
[ffmpeg.git] / libavutil / cast5.c
index 2309223022651cb29b0a1ef0ec5ee77c6c6183f7..c0d6d1e2e6c75f8c50b8cfd96676cfa642e8bbf0 100644 (file)
@@ -457,7 +457,7 @@ av_cold int av_cast5_init(AVCAST5* cs, const uint8_t *key, int key_bits)
         q[i]=AV_RB32(newKey+(4*i));
     generate_round_keys(cs->rounds,cs->Km,q,p);
     generate_round_keys(cs->rounds,cs->Kr,q,p);
-    for (i=0;i<cs->rounds;i++)
+    for (i=0;i<=cs->rounds;i++)
         cs->Kr[i]=cs->Kr[i]&0x1f;
     return 0;
 }