Skip to contentSkip to conversation

tools/ocaml: Fix OoB read in stub_syslog()

PATCH In review Andrew Cooper 2 participants 2 messages Nov 16 – Nov 24

lore
Share & tools
lore
#0 lore raw

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

__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

---
CC: Andrew Cooper <[email protected]>
CC: Andrii Sultanov <[email protected]>
CC: Guillaume Thouvenin <[email protected]>

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(-)
tools/ocaml/xenstored/syslog_stubs.c +1 -1
index 760e78ff73dc..16c7202d39ba 100644
@@ -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

Signature · 1 line
2.39.5
Acked-by on v1 1/1
#1 lore raw
Quoted 37 lines · Andrew Cooper

__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

---
CC: Andrew Cooper <[email protected]>
CC: Andrii Sultanov <[email protected]>
CC: Guillaume Thouvenin <[email protected]>

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(-)
tools/ocaml/xenstored/syslog_stubs.c +1 -1
index 760e78ff73dc..16c7202d39ba 100644
@@ -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)
Quoted 1 line

base-commit: 97bf370375113caf92fccf04e2877fc6b5ff887f