Explorar o código

fix overflow in run_command()

Aaron Marcher %!s(int64=8) %!d(string=hai) anos
pai
achega
c288663ebd
Modificáronse 1 ficheiros con 1 adicións e 1 borrados
  1. 1 1
      slstatus.c

+ 1 - 1
slstatus.c

@@ -451,7 +451,7 @@ run_command(const char *cmd)
 	pclose(fp);
 	buf[sizeof(buf) - 1] = '\0';
 
-	if ((nlptr = strstr(buf, "\n")) != NULL) {
+	if ((nlptr = strrchr(buf, '\n')) != NULL) {
 		nlptr[0] = '\0';
 	}