aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Phillips <dbphillipsnz@gmail.com>2016-04-26 16:15:12 +1200
committerDavid Phillips <dbphillipsnz@gmail.com>2016-04-26 16:15:12 +1200
commitce39e8e6fa1d8220e4050219ad72dfdc77ee1cfc (patch)
tree1a5ebbe51a05000b9a80f7d63278ee1efb916a9f
parent01a3d56ab3c71a065c3b827740dade5f27e95ef3 (diff)
downloadcue-bin-split-ce39e8e6fa1d8220e4050219ad72dfdc77ee1cfc.tar.xz
Fix snprintf overflow detection, add newline to error message
-rw-r--r--cue-bin-split.c2
-rw-r--r--misc.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/cue-bin-split.c b/cue-bin-split.c
index 4ebd843..2e2a190 100644
--- a/cue-bin-split.c
+++ b/cue-bin-split.c
@@ -141,7 +141,7 @@ int main(int argc, char **argv)
if (start_sample > finish_sample)
{
- fprintf(stderr, "ERROR: Finish time can't be before start time, skipping %s", out_fname);
+ fprintf(stderr, "ERROR: Finish time can't be before start time, skipping %s\n", out_fname);
continue;
}
diff --git a/misc.c b/misc.c
index 7ee275a..1515a7d 100644
--- a/misc.c
+++ b/misc.c
@@ -56,7 +56,7 @@ double get_sec()
*/
int construct_out_name(char *buffer, size_t buffer_size, char* format, unsigned int track)
{
- if (snprintf(buffer, buffer_size, format, track) == buffer_size)
+ if (snprintf(buffer, buffer_size, format, track) >= buffer_size - 1)
{
fprintf(stderr, "Filename too large for buffer (max %zd)\n", buffer_size);
return -1;