summaryrefslogtreecommitdiff
path: root/source/net_common.c
diff options
context:
space:
mode:
authorAndrey Nazarov <skuller@skuller.net>2008-10-03 12:49:06 +0000
committerAndrey Nazarov <skuller@skuller.net>2008-10-03 12:49:06 +0000
commitf8abe42a0d1a42653b39f6cf320d3fbdd1279bb3 (patch)
tree4e56e3647a4f9933f71c5f2cc03b4fa40bfc7709 /source/net_common.c
parent3fb2508c6c5976d418c377847bba1037fa843fff (diff)
Consolidated all MVD server code in a single file for easier portability.
Perform more strict configstring length checks server side. No longer stop reading packets in a loop after an ICMP error.
Diffstat (limited to 'source/net_common.c')
-rw-r--r--source/net_common.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/source/net_common.c b/source/net_common.c
index 3fbd1ec..c522d10 100644
--- a/source/net_common.c
+++ b/source/net_common.c
@@ -410,6 +410,7 @@ NET_GetPacket
Fills msg_read_buffer with packet contents,
net_from variable receives source address.
+Returns NET_ERROR only in case of ICMP error.
=============
*/
neterr_t NET_GetPacket( netsrc_t sock ) {
@@ -500,15 +501,21 @@ neterr_t NET_GetPacket( netsrc_t sock ) {
/*
=============
NET_SendPacket
+
+Returns NET_ERROR only in case of ICMP error.
=============
*/
neterr_t NET_SendPacket( netsrc_t sock, const netadr_t *to, size_t length, const void *data ) {
struct sockaddr_in addr;
int ret;
- if( length < 1 || length > MAX_PACKETLEN ) {
- Com_WPrintf( "%s: bad length: %"PRIz" bytes\n", __func__, length );
- return NET_ERROR;
+ if( !length ) {
+ return NET_AGAIN;
+ }
+
+ if( length > MAX_PACKETLEN ) {
+ Com_WPrintf( "%s: oversize length: %"PRIz" bytes\n", __func__, length );
+ return NET_AGAIN;
}
switch( to->type ) {