diff options
-rw-r--r-- | sbin/ping/ping.c | 5 | ||||
-rw-r--r-- | sbin/ping6/ping6.c | 4 |
2 files changed, 5 insertions, 4 deletions
diff --git a/sbin/ping/ping.c b/sbin/ping/ping.c index 765d7b943e5..873124175cc 100644 --- a/sbin/ping/ping.c +++ b/sbin/ping/ping.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ping.c,v 1.188 2016/09/17 09:19:44 florian Exp $ */ +/* $OpenBSD: ping.c,v 1.189 2016/09/17 09:21:16 florian Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -471,8 +471,9 @@ main(int argc, char *argv[]) if (datalen >= sizeof(struct payload)) /* can we time transfer */ timing = 1; packlen = datalen + MAXIPLEN + MAXICMPLEN; - if (!(packet = malloc((size_t)packlen))) + if (!(packet = malloc(packlen))) err(1, "malloc"); + if (!(options & F_PINGFILLED)) for (i = ECHOTMLEN; i < datalen; ++i) *datap++ = i; diff --git a/sbin/ping6/ping6.c b/sbin/ping6/ping6.c index 98049b572dc..adcc4e6c92e 100644 --- a/sbin/ping6/ping6.c +++ b/sbin/ping6/ping6.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ping6.c,v 1.201 2016/09/17 09:20:39 florian Exp $ */ +/* $OpenBSD: ping6.c,v 1.202 2016/09/17 09:21:16 florian Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -452,7 +452,7 @@ main(int argc, char *argv[]) packlen = datalen + IP6LEN + ECHOLEN + EXTRA; if (!(packet = malloc(packlen))) - err(1, "Unable to allocate packet"); + err(1, "malloc"); if (!(options & F_PINGFILLED)) for (i = ECHOTMLEN; i < datalen; ++i) |