From b42bc732ac42eafec5b7aed59279c08bf3f50735 Mon Sep 17 00:00:00 2001 From: Maarten Billemont Date: Thu, 23 Jan 2020 15:54:45 -0500 Subject: [PATCH] Ensure buffer is set. --- platform-independent/c/cli/src/mpw-cli.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/platform-independent/c/cli/src/mpw-cli.c b/platform-independent/c/cli/src/mpw-cli.c index 07693649..8ed0cefa 100644 --- a/platform-independent/c/cli/src/mpw-cli.c +++ b/platform-independent/c/cli/src/mpw-cli.c @@ -805,7 +805,7 @@ void cli_save(Arguments *args, Operation *operation) { char *buf = NULL; MPMarshalError marshalError = { .type = MPMarshalSuccess }; - if (!mpw_marshal_write( &buf, operation->sitesFormat, operation->user, &marshalError ) || marshalError.type != MPMarshalSuccess) + if (!mpw_marshal_write( &buf, operation->sitesFormat, operation->user, &marshalError ) || marshalError.type != MPMarshalSuccess || !buf) wrn( "Couldn't encode updated configuration file:\n %s: %s", operation->sitesPath, marshalError.description ); else if (fwrite( buf, sizeof( char ), strlen( buf ), sitesFile ) != strlen( buf )) @@ -858,5 +858,4 @@ void cli_masterKeyProvider_free() { __cli_masterKeyProvider_currentAlgorithm = (MPAlgorithmVersion)-1; mpw_free_string( &__cli_masterKeyProvider_currentPassword ); __cli_masterKeyProvider_currentOperation = NULL; - }