Merge pull request #6826 from daverodgman/fix_gettimeofday
Fix gettimeofday overflow
This commit is contained in:
commit
2038da9266
2 changed files with 4 additions and 1 deletions
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…
Add table
Add a link
Reference in a new issue