aboutsummaryrefslogtreecommitdiff
path: root/sprinter-sexp.c
diff options
context:
space:
mode:
authorPeter Wang <novalazy@gmail.com>2020-02-08 12:49:22 +1100
committerDavid Bremner <david@tethera.net>2020-02-13 19:10:42 -0400
commitc17fca40e2bc5514863d98807aaed318f144fd1a (patch)
treea507822484750dd2b832a28a3d5df6ff9f51e64d /sprinter-sexp.c
parente091427d98b0c49e96fb312ad1af6862776b896a (diff)
sprinter: change integer method to use int64_t
In particular, timestamps beyond 2038 could overflow the sprinter interface on systems where time_t is 64-bit but 'int' is a signed 32-bit integer type.
Diffstat (limited to 'sprinter-sexp.c')
-rw-r--r--sprinter-sexp.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/sprinter-sexp.c b/sprinter-sexp.c
index 6891ea42..35c007d5 100644
--- a/sprinter-sexp.c
+++ b/sprinter-sexp.c
@@ -18,6 +18,7 @@
* Author: Peter Feigl <peter.feigl@gmx.at>
*/
+#include <inttypes.h>
#include <stdbool.h>
#include <stdio.h>
#include <talloc.h>
@@ -161,11 +162,11 @@ sexp_keyword (struct sprinter *sp, const char *val)
}
static void
-sexp_integer (struct sprinter *sp, int val)
+sexp_integer (struct sprinter *sp, int64_t val)
{
struct sprinter_sexp *sps = sexp_begin_value (sp);
- fprintf (sps->stream, "%d", val);
+ fprintf (sps->stream, "%"PRId64, val);
}
static void