aboutsummaryrefslogtreecommitdiff
path: root/src/exit
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2013-07-21 16:29:30 +0000
committerChristian Grothoff <christian@grothoff.org>2013-07-21 16:29:30 +0000
commitf3adc188b34d52c03d0abbe05edbee3b0c227483 (patch)
treea00a9799ecf5342805d84cd883db4eb4088041ba /src/exit
parenta5a789193422feb75b13b7513cb4c62eb2871566 (diff)
downloadgnunet-f3adc188b34d52c03d0abbe05edbee3b0c227483.tar.gz
gnunet-f3adc188b34d52c03d0abbe05edbee3b0c227483.zip
-do NULL check before dereferencing
Diffstat (limited to 'src/exit')
-rw-r--r--src/exit/gnunet-daemon-exit.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/exit/gnunet-daemon-exit.c b/src/exit/gnunet-daemon-exit.c
index 924c846eb..dcaa90be0 100644
--- a/src/exit/gnunet-daemon-exit.c
+++ b/src/exit/gnunet-daemon-exit.c
@@ -1807,6 +1807,11 @@ receive_tcp_service (void *cls GNUNET_UNUSED, struct GNUNET_MESH_Tunnel *tunnel,
1807 const struct GNUNET_EXIT_TcpServiceStartMessage *start; 1807 const struct GNUNET_EXIT_TcpServiceStartMessage *start;
1808 uint16_t pkt_len = ntohs (message->size); 1808 uint16_t pkt_len = ntohs (message->size);
1809 1809
1810 if (NULL == state)
1811 {
1812 GNUNET_break_op (0);
1813 return GNUNET_SYSERR;
1814 }
1810 if (GNUNET_YES == state->is_dns) 1815 if (GNUNET_YES == state->is_dns)
1811 { 1816 {
1812 GNUNET_break_op (0); 1817 GNUNET_break_op (0);
@@ -1831,8 +1836,7 @@ receive_tcp_service (void *cls GNUNET_UNUSED, struct GNUNET_MESH_Tunnel *tunnel,
1831 } 1836 }
1832 start = (const struct GNUNET_EXIT_TcpServiceStartMessage*) message; 1837 start = (const struct GNUNET_EXIT_TcpServiceStartMessage*) message;
1833 pkt_len -= sizeof (struct GNUNET_EXIT_TcpServiceStartMessage); 1838 pkt_len -= sizeof (struct GNUNET_EXIT_TcpServiceStartMessage);
1834 if ( (NULL == state) || 1839 if ( (NULL != state->specifics.tcp_udp.serv) ||
1835 (NULL != state->specifics.tcp_udp.serv) ||
1836 (NULL != state->specifics.tcp_udp.heap_node) ) 1840 (NULL != state->specifics.tcp_udp.heap_node) )
1837 { 1841 {
1838 GNUNET_break_op (0); 1842 GNUNET_break_op (0);
@@ -1896,6 +1900,11 @@ receive_tcp_remote (void *cls GNUNET_UNUSED, struct GNUNET_MESH_Tunnel *tunnel,
1896 const void *payload; 1900 const void *payload;
1897 int af; 1901 int af;
1898 1902
1903 if (NULL == state)
1904 {
1905 GNUNET_break_op (0);
1906 return GNUNET_SYSERR;
1907 }
1899 if (GNUNET_YES == state->is_dns) 1908 if (GNUNET_YES == state->is_dns)
1900 { 1909 {
1901 GNUNET_break_op (0); 1910 GNUNET_break_op (0);
@@ -1919,8 +1928,7 @@ receive_tcp_remote (void *cls GNUNET_UNUSED, struct GNUNET_MESH_Tunnel *tunnel,
1919 } 1928 }
1920 start = (const struct GNUNET_EXIT_TcpInternetStartMessage*) message; 1929 start = (const struct GNUNET_EXIT_TcpInternetStartMessage*) message;
1921 pkt_len -= sizeof (struct GNUNET_EXIT_TcpInternetStartMessage); 1930 pkt_len -= sizeof (struct GNUNET_EXIT_TcpInternetStartMessage);
1922 if ( (NULL == state) || 1931 if ( (NULL != state->specifics.tcp_udp.serv) ||
1923 (NULL != state->specifics.tcp_udp.serv) ||
1924 (NULL != state->specifics.tcp_udp.heap_node) ) 1932 (NULL != state->specifics.tcp_udp.heap_node) )
1925 { 1933 {
1926 GNUNET_break_op (0); 1934 GNUNET_break_op (0);