diff --git a/wiretap/5views.c b/wiretap/5views.c index 9478f88cd3..5d51c1c8a7 100644 --- a/wiretap/5views.c +++ b/wiretap/5views.c @@ -391,7 +391,7 @@ static gboolean _5views_dump(wtap_dumper *wdh, * we should check against G_MININT32 and G_MAXINT32 and make * Utc a gint32. */ - if (rec->ts.secs < 0 || rec->ts.secs > G_MAXUINT32) { + if (rec->ts.secs < 0 || rec->ts.secs > WTAP_NSTIME_32BIT_SECS_MAX) { *err = WTAP_ERR_TIME_STAMP_NOT_SUPPORTED; return FALSE; } diff --git a/wiretap/netxray.c b/wiretap/netxray.c index 9e1ed447e9..74f244c2f2 100644 --- a/wiretap/netxray.c +++ b/wiretap/netxray.c @@ -1812,7 +1812,7 @@ netxray_dump_1_1(wtap_dumper *wdh, * G_MININT32 and G_MAXINT32 and make start_secs a * gint32. */ - if (rec->ts.secs < 0 || rec->ts.secs > G_MAXUINT32) { + if (rec->ts.secs < 0 || rec->ts.secs > WTAP_NSTIME_32BIT_SECS_MAX) { *err = WTAP_ERR_TIME_STAMP_NOT_SUPPORTED; return FALSE; } @@ -2011,7 +2011,7 @@ netxray_dump_2_0(wtap_dumper *wdh, * G_MININT32 and G_MAXINT32 and make start_secs a * gint32. */ - if (rec->ts.secs < 0 || rec->ts.secs > G_MAXUINT32) { + if (rec->ts.secs < 0 || rec->ts.secs > WTAP_NSTIME_32BIT_SECS_MAX) { *err = WTAP_ERR_TIME_STAMP_NOT_SUPPORTED; return FALSE; } diff --git a/wiretap/visual.c b/wiretap/visual.c index f0fa86ea33..4707c86bbe 100644 --- a/wiretap/visual.c +++ b/wiretap/visual.c @@ -685,7 +685,7 @@ static gboolean visual_dump(wtap_dumper *wdh, const wtap_rec *rec, * in which case we should check against G_MININT32 and G_MAXINT32 * and make start_time a gint32. */ - if (rec->ts.secs < 0 || rec->ts.secs > G_MAXUINT32) { + if (rec->ts.secs < 0 || rec->ts.secs > WTAP_NSTIME_32BIT_SECS_MAX) { *err = WTAP_ERR_TIME_STAMP_NOT_SUPPORTED; return FALSE; } diff --git a/wiretap/wtap.h b/wiretap/wtap.h index 4f6354d710..739367f777 100644 --- a/wiretap/wtap.h +++ b/wiretap/wtap.h @@ -1338,6 +1338,8 @@ typedef struct { #define BBLOG_TYPE_EVENT_BLOCK 1 #define BBLOG_TYPE_SKIPPED_BLOCK 2 +#define WTAP_NSTIME_32BIT_SECS_MAX ((time_t)(sizeof(time_t) > sizeof(gint32) ? G_MAXUINT32 : G_MAXINT32)) + typedef struct { guint rec_type; /* what type of record is this? */ guint32 presence_flags; /* what stuff do we have? */