Procházet zdrojové kódy

coroparse: Do not format too long path

32-bit compiler does produce warning about snprintf in the
main_config_parser_cb when path is longer than key_name.

Whole snprintf is basically no-op because key_name length is same as
error message buffer so snprintf never succeed.
Also whole problem shouldn't happen at all because too long path case
is handled by main_config_parser_cb caller.

Patch completely removes snprintf and just reports error about too long
path.

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Fabio M. Di Nitto <fdinitto@redhat.com>
Jan Friesse před 2 měsíci
rodič
revize
4fa1182afc
1 změnil soubory, kde provedl 2 přidání a 6 odebrání
  1. 2 6
      exec/coroparse.c

+ 2 - 6
exec/coroparse.c

@@ -655,12 +655,8 @@ static int main_config_parser_cb(const char *path,
 	 * Formally this check is not needed because length is checked by parse_section
 	 */
 	if (strlen(path) >= sizeof(key_name)) {
-		if (snprintf(formated_err, sizeof(formated_err),
-		    "Can't store path \"%s\" into key_name", path) >= sizeof(formated_err)) {
-			*error_string = "Can't format path into key_name error message";
-		} else {
-			*error_string = formated_err;
-		}
+		*error_string = "main_config_parser_cb path is longer than key_name";
+
 		return (0);
 	}
 	/*