diff options
author | /dev/humancontroller <devhc@example.com> | 2015-03-18 19:06:13 +0100 |
---|---|---|
committer | /dev/humancontroller <devhc@example.com> | 2017-02-08 02:17:00 +0100 |
commit | c6e1f74826a6579553944771f487ca6beb4257f4 (patch) | |
tree | 6c0fc163efa0df9bb7b6a105acd66c113428ca12 /src/client/cl_main.c | |
parent | 53b64d89f3f6f3c70e7eccc0cb5f29aec29febc1 (diff) |
fix the nullchar-termination in CL_GSRFeaturedLabel()
Diffstat (limited to 'src/client/cl_main.c')
-rw-r--r-- | src/client/cl_main.c | 6 |
1 files changed, 5 insertions, 1 deletions
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 |