From 1a46ee716dbcbf452e7aa3d3312cf81310f1ff20 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Thu, 23 Nov 2017 09:56:57 +0100 Subject: [PATCH] remove useless test, fgets() already ensures MAX_STRING_LEN Found by PVS-Studio - https://www.viva64.com/en/b/0540/ --- libs/ardour/vst_info_file.cc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/libs/ardour/vst_info_file.cc b/libs/ardour/vst_info_file.cc index b076c42227..d58b7a94a5 100644 --- a/libs/ardour/vst_info_file.cc +++ b/libs/ardour/vst_info_file.cc @@ -259,14 +259,14 @@ read_string (FILE *fp) return 0; } - if (strlen (buf) < MAX_STRING_LEN) { - if (strlen (buf)) { - buf[strlen (buf)-1] = 0; - } + if (strlen (buf)) { + /* strip lash char here: '\n', + * since VST-params cannot be longer than 127 chars. + */ + buf[strlen (buf)-1] = 0; return strdup (buf); - } else { - return 0; } + return 0; } /** Read an integer value from a line in fp into n,