chore: assert value of index before dereferencing

In the api_ffa_console_log an idx was incremented
and the result used to access a buffer.
Split the operation, and add asserts to avoid
Overrunning.

Signed-off-by: J-Alves <joao.alves@arm.com>
Change-Id: I7ec93b02bb585da1f256b17942a18ba8dccd7f14
diff --git a/src/api.c b/src/api.c
index bc58cbb..8112bab 100644
--- a/src/api.c
+++ b/src/api.c
@@ -4949,7 +4949,9 @@
 		if (c == '\n' || c == '\0') {
 			flush = true;
 		} else {
-			log_buffer->chars[log_buffer->len++] = c;
+			log_buffer->chars[log_buffer->len] = c;
+			log_buffer->len++;
+			assert(log_buffer->len <= LOG_BUFFER_SIZE);
 			flush = log_buffer->len == LOG_BUFFER_SIZE;
 		}