mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2024-12-29 09:21:19 +00:00
Merge pull request #6826 from daverodgman/fix_gettimeofday
Fix gettimeofday overflow
This commit is contained in:
commit
2038da9266
3
ChangeLog.d/fix-gettimeofday-overflow.txt
Normal file
3
ChangeLog.d/fix-gettimeofday-overflow.txt
Normal file
@ -0,0 +1,3 @@
|
||||
Bugfix
|
||||
* Fix possible integer overflow in mbedtls_timing_hardclock(), which
|
||||
could cause a crash in programs/test/benchmark.
|
@ -398,7 +398,7 @@ static unsigned long mbedtls_timing_hardclock( void )
|
||||
}
|
||||
|
||||
gettimeofday( &tv_cur, NULL );
|
||||
return( ( tv_cur.tv_sec - tv_init.tv_sec ) * 1000000
|
||||
return( ( tv_cur.tv_sec - tv_init.tv_sec ) * 1000000U
|
||||
+ ( tv_cur.tv_usec - tv_init.tv_usec ) );
|
||||
}
|
||||
#endif /* !HAVE_HARDCLOCK */
|
||||
|
Loading…
Reference in New Issue
Block a user