Handle potential NULL return from string_skip_prefix()

This commit is contained in:
Ian Barwick
2019-03-28 12:45:53 +09:00
parent fd86160dff
commit e672f7e3ee

View File

@@ -6084,10 +6084,11 @@ run_file_backup(t_node_info *node_record)
* Remove prefix * Remove prefix
*/ */
p = string_skip_prefix(prefix, output); p = string_skip_prefix(prefix, output);
if (p == NULL) if (p == NULL)
{ {
log_error("unexpected output from \"barman list-files\": %s", log_error("unexpected output from \"barman list-files\"");
output); log_detail("%s", output);
exit(ERR_BARMAN); exit(ERR_BARMAN);
} }
@@ -6105,6 +6106,14 @@ run_file_backup(t_node_info *node_record)
strncat(prefix, backup_id, MAXLEN - 1); strncat(prefix, backup_id, MAXLEN - 1);
strncat(prefix, "/", MAXLEN - 1); strncat(prefix, "/", MAXLEN - 1);
p = string_skip_prefix(backup_id, p); p = string_skip_prefix(backup_id, p);
if (p == NULL)
{
log_error("unexpected output from \"barman list-files\"");
log_detail("%s", output);
exit(ERR_BARMAN);
}
p = string_skip_prefix("/", p); p = string_skip_prefix("/", p);
/* /*
@@ -6116,8 +6125,8 @@ run_file_backup(t_node_info *node_record)
basebackups_directory, basebackups_directory,
backup_id, backup_id,
local_repmgr_tmp_directory); local_repmgr_tmp_directory);
(void) local_command(
command, (void) local_command(command,
NULL); NULL);
/* /*