File buildfixes.diff of Package openocd
---
src/helper/command.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
Index: b/src/helper/command.c
===================================================================
--- a/src/helper/command.c
+++ b/src/helper/command.c
@@ -329,8 +329,10 @@ void command_print(command_context_t *co
string = alloc_vprintf(format, ap);
if (string != NULL)
{
- strcat(string, "\n"); /* alloc_vprintf guaranteed the buffer to be at least one char longer */
- context->output_handler(context, string);
+ /* alloc_vprintf guaranteed the buffer to be at least one char longer */
+ strcat(string, "\n");
+ if (context && context->output_handler && string)
+ context->output_handler(context, string);
free(string);
}
@@ -558,7 +560,7 @@ void command_print_help_line(command_con
snprintf(name_buf, 64, command->name);
if (indent)
- strncat(name_buf, indent_text, 64);
+ strncat(name_buf, indent_text, 64 - strlen(name_buf) - 1);
command_print(context, "%20s\t%s", name_buf, help, indent);