Menu

#66 year-2038 issue in plugin_blacklist

none
closed-fixed
None
5
2026-03-12
2026-03-06
No

I was reviewing potential year-2038 issues in openSUSE
and found one of the issues was already fixed by commit 91e041dbfcccbe5dd6fb96e01826d55d408dad4d .

However
src/plugin_blacklist.c still has several places where sqlite3_bind_int is used with a time_t. It should probably use sqlite3_bind_int64 instead.

Here are the warnings for siproxd-0.8.3 (using an experimental patch in openSUSE Tumbleweed's gcc15)

plugin_blacklist.c: In function 'blacklist_check':
plugin_blacklist.c:326:55: warning: conversion from 'time_t' to 'int' loses too much precision [-Wtime_t-conversion]
326 | sts = sqlite3_bind_int(sql_stmt->stmt, 003, ticket->timestamp);
| ~~~~~~^~~~~~~~~~~
plugin_blacklist.c:344:58: warning: conversion from 'time_t' to 'int' loses too much precision [-Wtime_t-conversion]
344 | sts = sqlite3_bind_int(sql_stmt->stmt, 001, ticket->timestamp);
| ~~~~~~^~~~~~~~~~~
plugin_blacklist.c:360:58: warning: conversion from 'time_t' to 'int' loses too much precision [-Wtime_t-conversion]
360 | sts = sqlite3_bind_int(sql_stmt->stmt, 001, ticket->timestamp);
| ~~~~~~^~~~~~~~~~~
plugin_blacklist.c: In function 'blacklist_update':
plugin_blacklist.c:427:67: warning: source 'plugin_cfg.register_window' with type 'int' of conversion to 'time_t' lacks precision [-Wtime_t-conversion]
427 | sts = sqlite3_bind_int(sql_stmt->stmt, 001, ticket->timestamp - plugin_cfg.register_window);
| ^
plugin_blacklist.c:427:67: warning: conversion from 'time_t' to 'int' loses too much precision [-Wtime_t-conversion]
427 | sts = sqlite3_bind_int(sql_stmt->stmt, 001, ticket->timestamp - plugin_cfg.register_window);
| ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
plugin_blacklist.c:488:61: warning: conversion from 'time_t' to 'int' loses too much precision [-Wtime_t-conversion]
488 | sts = sqlite3_bind_int(sql_stmt->stmt, 003, ticket->timestamp);
| ~~~~~~^~~~~~~~~~~
plugin_blacklist.c: In function 'blacklist_expire':
plugin_blacklist.c:529:55: warning: source 'plugin_cfg.duration' with type 'int' of conversion to 'time_t' lacks precision [-Wtime_t-conversion]
529 | sts = sqlite3_bind_int(sql_stmt->stmt, 002, now-plugin_cfg.duration);
| ^
plugin_siptrunk.c:40:19: warning: 'ident' defined but not used [-Wunused-const-variable=]
40 | static char const ident[]="$Id: plugin_siptrunk.c 578 2017-10-24 18:56:46Z hb9xar $";
| ^~~~~
plugin_blacklist.c:529:55: warning: conversion from 'time_t' to 'int' loses too much precision [-Wtime_t-conversion]
529 | sts = sqlite3_bind_int(sql_stmt->stmt, 002, now-plugin_cfg.duration);
| ~~~^~~~~~~~~~~~~~~~~~~~
plugin_blacklist.c:542:52: warning: conversion from 'time_t' to 'int' loses too much precision [-Wtime_t-conversion]
542 | sts = sqlite3_bind_int(sql_stmt->stmt, 001, now-86400);
| ~~~^~~~~~

See https://en.wikipedia.org/wiki/Year_2038_problem

Discussion

  • Thomas Ries

    Thomas Ries - 2026-03-09
    • status: open --> pending
    • assigned_to: Thomas Ries
     
  • Thomas Ries

    Thomas Ries - 2026-03-12

    Thank you for reporting this issue.

    The suggested fix has been implemented with commit 879925a80b5d80f425abeb82d934b1425c7830cd

     
  • Thomas Ries

    Thomas Ries - 2026-03-12
    • status: pending --> closed-fixed
     

Log in to post a comment.

MongoDB Logo MongoDB