On Wed, Nov 29, 2017 at 01:59:06AM +0100, Claudio Jeker wrote:
> Seen in my log file:
> Nov 28 17:47:22 dramaqueen iked: vfprintf %s NULL in "%s: %s %s from %s to
> %s ms gid %u, %ld bytes%s"
>
> and
>
> Nov 29 01:02:39 dramaqueen iked[49967]: ikev2_msg_send: IKE_SA_INIT
> request from (null) to 62.48.30.5:500 msgid 0, 438 bytes
>
> The problem seems to be in print_host so try to not return NULL in there.
> Maybe we could return something else but this is a start IMO.
beck@ prefers to just print unknown instead of the gai_strerror -- guess
that is more sensible.
--
:wq Claudio
Index: util.c
===================================================================
RCS file: /cvs/src/sbin/iked/util.c,v
retrieving revision 1.33
diff -u -p -r1.33 util.c
--- util.c 9 Jan 2017 14:49:21 -0000 1.33
+++ util.c 29 Nov 2017 01:16:21 -0000
@@ -654,8 +654,8 @@ print_host(struct sockaddr *sa, char *bu
if (getnameinfo(sa, sa->sa_len,
buf, len, NULL, 0, NI_NUMERICHOST) != 0) {
- buf[0] = '\0';
- return (NULL);
+ strlcpy(buf, "unknown", len);
+ return (buf);
}
if ((port = socket_getport(sa)) != 0) {