Added check for validity of receivefrom result (ohops).

This commit is contained in:
Markus Stenberg 2013-01-28 16:21:52 +02:00
parent 9ed54c2eaf
commit 8b56df87c5
2 changed files with 4 additions and 3 deletions

View file

@ -246,6 +246,7 @@ static int meth_receivefrom(lua_State *L)
lua_pushstring(L, gai_strerror(err));
return 2;
}
lua_pushlstring(L, buffer, got);
lua_pushstring(L, addrstr);
lua_pushstring(L, portstr);
return 3;

View file

@ -8,8 +8,8 @@
-- Copyright (c) 2012 cisco Systems, Inc.
--
-- Created: Wed Dec 5 09:55:46 2012 mstenber
-- Last modified: Wed Dec 5 18:33:09 2012 mstenber
-- Edit time: 50 min
-- Last modified: Mon Jan 28 16:20:14 2013 mstenber
-- Edit time: 54 min
--
-- exercise the new IPv6 related functionality:
@ -96,7 +96,7 @@ local r, err = c:sendto(testdata, mcast .. '%' .. ifname, port)
assert(r, 'sendto failed (mcast)')
local data, host, port = s:receivefrom()
assert(data)
assert(data == testdata, 'weird data ' .. tostring(data))
print('recvfrom', host, port)
-- make sure we can send stuff back to link-local addr as well'