[PATCH] tools/ocaml: Fix OoB read in stub_syslog()

Andrew Cooper posted 1 patch 6 days, 23 hours ago
tools/ocaml/xenstored/syslog_stubs.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] tools/ocaml: Fix OoB read in stub_syslog()
Posted by Andrew Cooper 6 days, 23 hours ago
__syslog_facility_table[] maps Ocaml LOG_* facilities indices to local system
indices.  The final line is intended to initialise 6 entries in the table, but
only initalises one with the logical OR of 6 facilities, making the table 5
entries too short.

This is probably a copy&paste error from Ocaml, where | is right operator to
use for a list of this nature.

Fixes: ea8ddf27e5c8 ("ocaml: add logging bindings.")
Assisted-by: LLM
Reported-by: Olivier Lambert <olivier.lambert@vates.tech>
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
CC: Andrew Cooper <andrew.cooper3@citrix.com>
CC: Andrii Sultanov <andriy.sultanov@vates.tech>
CC: Guillaume Thouvenin <guillaume.thouvenin@vates.tech>

This is only an issue if you modify oxenstored.conf to use one of these
facilities.
---
 tools/ocaml/xenstored/syslog_stubs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/ocaml/xenstored/syslog_stubs.c b/tools/ocaml/xenstored/syslog_stubs.c
index 760e78ff73dc..16c7202d39ba 100644
--- a/tools/ocaml/xenstored/syslog_stubs.c
+++ b/tools/ocaml/xenstored/syslog_stubs.c
@@ -30,7 +30,7 @@ static int __syslog_facility_table[] = {
 	LOG_AUTH, LOG_AUTHPRIV, LOG_CRON, LOG_DAEMON, LOG_FTP, LOG_KERN,
 	LOG_LOCAL0, LOG_LOCAL1, LOG_LOCAL2, LOG_LOCAL3,
 	LOG_LOCAL4, LOG_LOCAL5, LOG_LOCAL6, LOG_LOCAL7,
-	LOG_LPR | LOG_MAIL | LOG_NEWS | LOG_SYSLOG | LOG_USER | LOG_UUCP
+	LOG_LPR, LOG_MAIL, LOG_NEWS, LOG_SYSLOG, LOG_USER, LOG_UUCP,
 };
 
 value stub_syslog(value facility, value level, value msg)

base-commit: 97bf370375113caf92fccf04e2877fc6b5ff887f
-- 
2.39.5