Fix potential runaway string.
authorCarl Hetherington <cth@carlh.net>
Sun, 12 May 2019 21:51:46 +0000 (22:51 +0100)
committerCarl Hetherington <cth@carlh.net>
Sun, 12 May 2019 21:51:46 +0000 (22:51 +0100)
src/lib/transcode_job.cc

index 1db37e3708b27748ada7455763a2c753e63e30f6..356e862e0c87bb14de9d00d4ff7a6935abdfc5b2 100644 (file)
@@ -120,7 +120,8 @@ TranscodeJob::status () const
 
        char buffer[256];
        if (finished() || _encoder->finishing()) {
-               strncpy (buffer, Job::status().c_str(), 256);
+               strncpy (buffer, Job::status().c_str(), 255);
+               buffer[255] = '\0';
        } else {
                snprintf (
                        buffer, sizeof(buffer), "%s; %" PRId64 "/%" PRId64 " frames",