diff --git a/sources/scram.c b/sources/scram.c index 7bdd0f315..f2f0129e4 100644 --- a/sources/scram.c +++ b/sources/scram.c @@ -653,6 +653,9 @@ int od_scram_read_client_final_message(machine_io_t *io, strlen("p=tls-server-end-point,,"); /* p=type,, */ cbind_input_len = cbind_header_len + cbind_data_len; cbind_input = malloc(cbind_input_len); + if (cbind_input == NULL) { + goto error; + } snprintf(cbind_input, cbind_input_len, "p=tls-server-end-point,,"); memcpy(cbind_input + cbind_header_len, cbind_data, @@ -661,6 +664,9 @@ int od_scram_read_client_final_message(machine_io_t *io, b64_message_len = pg_b64_enc_len(cbind_input_len); /* don't forget the zero-terminator */ b64_message = malloc(b64_message_len + 1); + if (b64_message == NULL) { + goto error; + } b64_message_len = od_b64_encode(cbind_input, cbind_input_len, b64_message, b64_message_len); if (b64_message_len < 0) { @@ -885,4 +891,4 @@ od_scram_create_server_final_message(od_scram_state_t *scram_state) free(result); return NULL; -} \ No newline at end of file +}