Xinqi Bao's Git

fix overflow in run_command()
authorAaron Marcher <[email protected]>
Thu, 20 Apr 2017 20:20:19 +0000 (22:20 +0200)
committerAaron Marcher <[email protected]>
Thu, 20 Apr 2017 20:20:19 +0000 (22:20 +0200)
slstatus.c

index 5500a62..f06c373 100644 (file)
@@ -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';
        }