summaryrefslogtreecommitdiff
path: root/accel-pppd/lua
diff options
context:
space:
mode:
authorVladislav Grishenko <themiron@mail.ru>2018-03-04 02:29:46 +0500
committerVladislav Grishenko <themiron@mail.ru>2018-03-04 02:41:47 +0500
commit939e952452dd856a574a1d78c15181a93a593996 (patch)
tree3e6b12fab35b12cda2be553faec05755a598d4da /accel-pppd/lua
parent5ccf2f0409c18e216c4da5c7cce5e9fcf14ebf54 (diff)
downloadaccel-ppp-939e952452dd856a574a1d78c15181a93a593996.tar.gz
accel-ppp-939e952452dd856a574a1d78c15181a93a593996.zip
fix possible null pointer dereferences
Diffstat (limited to 'accel-pppd/lua')
-rw-r--r--accel-pppd/lua/session.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/accel-pppd/lua/session.c b/accel-pppd/lua/session.c
index d65a67bd..277b299f 100644
--- a/accel-pppd/lua/session.c
+++ b/accel-pppd/lua/session.c
@@ -217,11 +217,12 @@ static int session_rx_bytes(lua_State *L)
{
struct ap_session *ses = luaL_checkudata(L, 1, LUA_AP_SESSION);
uint64_t gword_sz = (uint64_t)UINT32_MAX + 1;
- uint64_t bytes = gword_sz*ses->acct_input_gigawords + ses->acct_rx_bytes;
+ uint64_t bytes;
if (!ses)
return 0;
+ bytes = gword_sz*ses->acct_input_gigawords + ses->acct_rx_bytes;
lua_pushnumber(L, bytes);
return 1;
@@ -231,11 +232,12 @@ static int session_tx_bytes(lua_State *L)
{
struct ap_session *ses = luaL_checkudata(L, 1, LUA_AP_SESSION);
uint64_t gword_sz = (uint64_t)UINT32_MAX + 1;
- uint64_t bytes = gword_sz*ses->acct_output_gigawords + ses->acct_tx_bytes;
+ uint64_t bytes;
if (!ses)
return 0;
+ bytes = gword_sz*ses->acct_output_gigawords + ses->acct_tx_bytes;
lua_pushnumber(L, bytes);
return 1;