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
1 changed files with 1 additions and 1 deletions

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);