Browse Source

ctl: proper trim for long error messages to avoid out of bounds access

Daniel-Constantin Mierla 9 năm trước cách đây
mục cha
commit
aeb9b5af70
1 tập tin đã thay đổi với 1 bổ sung1 xóa
  1. 1 1
      modules/ctl/binrpc_run.c

+ 1 - 1
modules/ctl/binrpc_run.c

@@ -503,7 +503,7 @@ static int rpc_fault_prepare(struct binrpc_ctx* ctx, int code, char* fmt, ...)
 	}
 	va_start(ap, fmt);
 	len=vsnprintf(buf, MAX_FAULT_LEN, fmt, ap); /* ignore trunc. errors */
-	if ((len<0) || (len > MAX_FAULT_LEN))
+	if ((len<0) || (len >= MAX_FAULT_LEN))
 		len=MAX_FAULT_LEN-1;
 	va_end(ap);