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:
@@ -3,6 +3,7 @@
|
||||
#ifndef R_MESSAGES_H
|
||||
#define R_MESSAGES_H
|
||||
|
||||
#include "db.h"
|
||||
#include "r_error.h"
|
||||
#include <json-c/json.h>
|
||||
#include <stdbool.h>
|
||||
@@ -37,4 +38,6 @@ int messages_count(messages_handle msgs);
|
||||
|
||||
char *messages_generate_session_id(void);
|
||||
|
||||
db_handle messages_get_db(messages_handle msgs);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -24,7 +24,6 @@ bool r_config_is_verbose(r_config_handle cfg);
|
||||
void r_config_set_verbose(r_config_handle cfg, bool verbose);
|
||||
|
||||
double r_config_get_temperature(r_config_handle cfg);
|
||||
int r_config_get_max_tokens(r_config_handle cfg);
|
||||
|
||||
const char *r_config_get_session_id(r_config_handle cfg);
|
||||
bool r_config_set_session_id(r_config_handle cfg, const char *session_id);
|
||||
|
||||
Reference in New Issue
Block a user