From c6e1f74826a6579553944771f487ca6beb4257f4 Mon Sep 17 00:00:00 2001 From: /dev/humancontroller Date: Wed, 18 Mar 2015 19:06:13 +0100 Subject: fix the nullchar-termination in CL_GSRFeaturedLabel() --- src/client/cl_main.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/client/cl_main.c') diff --git a/src/client/cl_main.c b/src/client/cl_main.c index 9f8e4279..b9c20d34 100644 --- a/src/client/cl_main.c +++ b/src/client/cl_main.c @@ -2515,7 +2515,6 @@ The result is copied to *buf, and *data is advanced as appropriate void CL_GSRFeaturedLabel( byte **data, char *buf, int size ) { char *l = buf; - buf[0] = '\0'; // copy until '\0' which indicates field break // or slash which indicates beginning of server list @@ -2528,6 +2527,11 @@ void CL_GSRFeaturedLabel( byte **data, char *buf, int size ) "CL_GSRFeaturedLabel: overflow\n" ); l++, (*data)++; } + + if( l < &buf[ size - 1 ] ) + *l = '\0'; + else + buf[ size - 1 ] = '\0'; } #define MAX_SERVERSPERPACKET 256 -- cgit