1
0
mirror of https://github.com/Mbed-TLS/mbedtls.git synced 2025-05-28 16:21:27 +03:00

Merge pull request #6827 from daverodgman/mbedtls-2.28

Backport 2.28 - fix gettimeofday overflow
This commit is contained in:
Dave Rodgman 2022-12-20 16:01:34 +00:00 committed by GitHub
commit 97a85fe110
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 1 deletions

View File

@ -0,0 +1,4 @@
Bugfix
* Fix possible integer overflow in mbedtls_timing_hardclock(), which
could cause a crash for certain platforms & compiler options.

View File

@ -223,7 +223,7 @@ unsigned long mbedtls_timing_hardclock( void )
} }
gettimeofday( &tv_cur, NULL ); 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 ) ); + ( tv_cur.tv_usec - tv_init.tv_usec ) );
} }
#endif /* !HAVE_HARDCLOCK */ #endif /* !HAVE_HARDCLOCK */