laforge has submitted this change. (
https://gerrit.osmocom.org/c/osmo-pcap/+/42842?usp=email )
Change subject: client: Fix 32-bit overflow when computing pcapng EPB timestamp
......................................................................
client: Fix 32-bit overflow when computing pcapng EPB timestamp
tv_sec * 1000 * 1000 was evaluated in int arithmetic. Where time_t /
tv_sec is 32-bit, this overflows for any tv_sec > ~2147, corrupting
the 64-bit timestamp_usec well before the year 2038. Cast tv_sec to
uint64_t before the multiplication so the whole expression
is computed in 64 bits.
Change-Id: I20d3282b8cba1675ce2d0860e66027e5ee8245ef
AI-Assisted: yes (Claude)
---
M src/osmo_client_network.c
1 file changed, 1 insertion(+), 1 deletion(-)
Approvals:
laforge: Looks good to me, approved
Jenkins Builder: Verified
diff --git a/src/osmo_client_network.c b/src/osmo_client_network.c
index 4b91429..69308fe 100644
--- a/src/osmo_client_network.c
+++ b/src/osmo_client_network.c
@@ -207,7 +207,7 @@
int rc;
epb_pars = (struct osmo_pcapng_file_epb_pars){
- .timestamp_usec = (pkthdr->ts.tv_sec * 1000 * 1000) +
pkthdr->ts.tv_usec,
+ .timestamp_usec = ((uint64_t)pkthdr->ts.tv_sec * 1000 * 1000) +
pkthdr->ts.tv_usec,
.interface_id = ph->idx,
.captured_data = data,
.captured_len = pkthdr->caplen,
--
To view, visit https://gerrit.osmocom.org/c/osmo-pcap/+/42842?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: osmo-pcap
Gerrit-Branch: master
Gerrit-Change-Id: I20d3282b8cba1675ce2d0860e66027e5ee8245ef
Gerrit-Change-Number: 42842
Gerrit-PatchSet: 3
Gerrit-Owner: fixeria <[email protected]>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <[email protected]>
Gerrit-Reviewer: pespin <[email protected]>