1
0
Fork 0

hostname() null terminaiton subtraction *is* needed

This commit is contained in:
Aaron Marcher 2016-09-14 11:04:24 +02:00 committed by Aaron Marcher (drkhsh)
parent bca9b5246a
commit 1ad9f2504d

View file

@ -273,7 +273,7 @@ hostname(void)
fgets(hostname, sizeof(hostname), fp); fgets(hostname, sizeof(hostname), fp);
/* FIXME: needs improvement */ /* FIXME: needs improvement */
memset(&hostname[strlen(hostname)], '\0', memset(&hostname[strlen(hostname)-1], '\0',
sizeof(hostname) - strlen(hostname)); sizeof(hostname) - strlen(hostname));
fclose(fp); fclose(fp);