Explorar el Código

hostname() null terminaiton subtraction *is* needed

Aaron Marcher hace 9 años
padre
commit
1ad9f2504d
Se han modificado 1 ficheros con 1 adiciones y 1 borrados
  1. 1 1
      slstatus.c

+ 1 - 1
slstatus.c

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