diff --git a/cheevos.c b/cheevos.c index 53da6c4761..96bbbb84a3 100644 --- a/cheevos.c +++ b/cheevos.c @@ -1301,13 +1301,13 @@ int cheevos_get_by_content( const char** json, const void* data, size_t size ) game_id = cheevos_get_game_id( hash ); - if ( !game_id ) + if ( !game_id && size < CHEEVOS_EIGHT_MB ) { - /* If the content is a SNES game, continue MD5 with zeroes. */ + /* Maybe the content is a SNES game, continue MD5 with zeroes up to 8MB. */ size = CHEEVOS_EIGHT_MB - size; memset( (void*)buffer, 0, sizeof( buffer ) ); - while ( size ) + do { len = sizeof( buffer ); @@ -1316,7 +1316,7 @@ int cheevos_get_by_content( const char** json, const void* data, size_t size ) MD5_Update( &saved_ctx, (void*)buffer, len ); size -= len; - } + }while(size); MD5_Final( hash, &saved_ctx );