From b39121c6a682eb8ae5efd29a875bd7c098185f04 Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Fri, 20 Feb 2015 00:31:09 -0500 Subject: Refactor config file API. The config file API previously relied on binding config variables using M_BindVariable() which took a void pointer. It occurred to me that if used on a boolean variable, this would be erroneous, but the void pointer would make it impossible to tell. Split this into separate M_Bind{Foo}Variable() functions based on type, which allows for proper type checking on the pointers that are passed. Vaguely related to #509. --- src/net_client.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/net_client.c') diff --git a/src/net_client.c b/src/net_client.c index 54903dae..e0037e3e 100644 --- a/src/net_client.c +++ b/src/net_client.c @@ -1102,5 +1102,5 @@ void NET_Init(void) void NET_BindVariables(void) { - M_BindVariable("player_name", &net_player_name); + M_BindStringVariable("player_name", &net_player_name); } -- cgit v1.2.3 From 01a743cd351d146e9b9ea7f7ca5b1c05e01da68e Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Sun, 22 Feb 2015 00:28:23 -0500 Subject: Fix mistaken uses of memcpy() on overlapping memory. The source and destination arguments to memcpy() cannot be overlapping as this is undefined behavior. In these situations memmove() must be used instead, and OpenBSD actually throws an error if this is done. Thanks to ryan-sg for reporting this. This fixes #510. --- src/net_client.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/net_client.c') diff --git a/src/net_client.c b/src/net_client.c index e0037e3e..ac81e367 100644 --- a/src/net_client.c +++ b/src/net_client.c @@ -279,8 +279,8 @@ static void NET_CL_AdvanceWindow(void) // Advance the window - memcpy(recvwindow, recvwindow + 1, - sizeof(net_server_recv_t) * (BACKUPTICS - 1)); + memmove(recvwindow, recvwindow + 1, + sizeof(net_server_recv_t) * (BACKUPTICS - 1)); memset(&recvwindow[BACKUPTICS-1], 0, sizeof(net_server_recv_t)); ++recvwindow_start; -- cgit v1.2.3