path: Fix an integer overflow in l_path_get_mtime
PATCH 1/1 path: Fix an integer overflow in l_path_get_mtime
time_t may be 32 bits wide (also signed) so we need to cast timespec.tv_sec to uint64_t before multiplying by 1000000.
--- ell/path.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
ell/path.c +2 -1
@@ -162,7 +162,8 @@ LIB_EXPORT uint64_t l_path_get_mtime(const char *path)if (ret <0 )return L_TIME_INVALID ; -return sb.st_mtim.tv_sec *1000000 + sb.st_mtim.tv_nsec /1000 ; +return (uint64_t ) sb.st_mtim.tv_sec *1000000 + + sb.st_mtim.tv_nsec /1000 ; }/**
Signature · 1 line
2.20.1
Denis Kenzior
AppliedHi Andrew,
Quoted 6 lines · Andrew Zaborowski
time_tmay be 32 bits wide (also signed) so we need to cast timespec.tv_sec touint64_tbefore multiplying by 1000000.--- ell/path.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
Applied, thanks.
Regards,
-Denis