From 99f0ba06312fb8a4104753671070b80a95c9951e Mon Sep 17 00:00:00 2001 From: Masahide NAKAMURA Date: Sun, 29 Apr 2007 00:06:18 +0900 Subject: [PATCH] [DEBUG] MH: Restrict error code from inet6_rth_XXX. --- src/mh.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/src/mh.c b/src/mh.c index b0a9520..dd700cb 100644 --- a/src/mh.c +++ b/src/mh.c @@ -619,6 +619,10 @@ int mh_send(const struct in6_addr_bundle cmsglen = CMSG_SPACE(sizeof(pinfo)); if (addrs->remote_coa != NULL) { rthlen = inet6_rth_space(IPV6_RTHDR_TYPE_2, 1); + if (!rthlen) { + MDBG("inet6_rth_space error\n"); + return -1; + } cmsglen += CMSG_SPACE(rthlen); } cmsg = malloc(cmsglen); @@ -658,6 +662,7 @@ int mh_send(const struct in6_addr_bundle rthp = inet6_rth_init(rthp, rthlen, IPV6_RTHDR_TYPE_2, 1); if (rthp == NULL) { free(msg.msg_control); + MDBG("inet6_rth_init error\n"); return -3; } inet6_rth_add(rthp, addrs->remote_coa); -- 1.4.3.GIT