feat: replace strcpy/strcat with memcpy and add null-termination across multiple source files

Replace unsafe string concatenation patterns using strcpy/strcat with explicit memcpy calls and proper null-termination in bash_repair.c, context_manager.c, context_summarizer.c, and db.c. Add missing null-pointer checks for strdup results in bash_executor.c. Introduce atomic_int for spinner_running flag in http_client.c. Add consecutive_tool_error_iterations field to agent struct and refactor agent heartbeat/token tracking to use messages_get_db instead of db_open. Remove r_config_get_max_tokens declaration from r_config.h. Add json_repair.c to Makefile build sources and include db.h in messages.h with new messages_get_db function declaration.
This commit is contained in:
2026-04-03 08:42:43 +00:00
parent 9bd9595145
commit 34cacf55d2
28 changed files with 508 additions and 247 deletions
+2 -1
View File
@@ -1,7 +1,7 @@
# retoor <retoor@molodetz.nl>
CC = gcc
CFLAGS = -Ofast -Werror -Wall -I./include
CFLAGS = -O3 -Werror -Wall -Wextra -Wshadow -I./include
LDFLAGS = -lreadline -lncurses -lcurl -ljson-c -lsqlite3 -lm -lpthread -lssl -lcrypto
SRCDIR = src
@@ -21,6 +21,7 @@ SRC_CORE = $(SRCDIR)/r_error.c \
$(SRCDIR)/context_manager.c \
$(SRCDIR)/markdown.c \
$(SRCDIR)/r_diff.c \
$(SRCDIR)/json_repair.c \
$(SRCDIR)/main.c
SRC_TOOLS = $(TOOLSDIR)/tools_init.c \