From 5d0f3ecfbb4e1a0d1fe812998963ffd932a051ca Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 24 Apr 2026 10:19:06 +0000 Subject: [PATCH] Fix fscanf width specifiers in copyover_recover() to prevent buffer overflow Agent-Logs-Url: https://github.com/tbamud/tbamud/sessions/82069e78-2bd9-4ff9-9053-0d47dfae5193 Co-authored-by: welcor <357770+welcor@users.noreply.github.com> --- src/comm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/comm.c b/src/comm.c index ed7d609..5e6bbf5 100644 --- a/src/comm.c +++ b/src/comm.c @@ -415,7 +415,7 @@ void copyover_recover() for (;;) { fOld = TRUE; - if (fscanf(fp, "%d %ld %s %s %s\n", &desc, &pref, name, host, guiopt) != 5) { + if (fscanf(fp, "%d %ld %511s %1023s %1023s\n", &desc, &pref, name, host, guiopt) != 5) { if(!feof(fp)) { if(ferror(fp)) log("SYSERR: error reading copyover file %s: %s", COPYOVER_FILE, strerror(errno));