From 4ce37bde9d9e7f0954363a38042550c004535531 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibaut=20VAR=C3=88NE?= Date: Sat, 27 Jul 2024 20:59:40 +0200 Subject: [PATCH] netout: add minimal sanity checks --- netout.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/netout.c b/netout.c index 4cc85b5..60b6b93 100644 --- a/netout.c +++ b/netout.c @@ -93,6 +93,9 @@ void Netoutpp(acarsmsg_t *msg) char *pstr; int res; + if (!msg) + return; + char *txt = strdup(msg->txt); for (pstr = txt; *pstr != 0; pstr++) if (*pstr == '\n' || *pstr == '\r') @@ -112,6 +115,9 @@ void Netoutsv(acarsmsg_t *msg, char *idstation, int chn, struct timeval tv) struct tm tmp; int res; + if (!msg) + return; + gmtime_r(&(tv.tv_sec), &tmp); res = snprintf(pkt, sizeof(pkt), @@ -126,5 +132,6 @@ void Netoutsv(acarsmsg_t *msg, char *idstation, int chn, struct timeval tv) void Netoutjson(char *jsonbuf) { - Netwrite(jsonbuf, strlen(jsonbuf)); + if (jsonbuf) + Netwrite(jsonbuf, strlen(jsonbuf)); }