Review at  https://gerrit.osmocom.org/4716

reset: check length of the reset context name

When allocating a reset context, the user must supply a human
readable string name. At the moment the length of this name
is not checked

Check the length of the string name.

This fixes CID 178664

Change-Id: Id7c4a7ff17e1c8ceb6e543ab6f0f07c87df603c7
---
M src/libcommon-cs/a_reset.c
1 file changed, 3 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-msc refs/changes/16/4716/1

diff --git a/src/libcommon-cs/a_reset.c b/src/libcommon-cs/a_reset.c
index 7dbd014..0bf36c6 100644
--- a/src/libcommon-cs/a_reset.c
+++ b/src/libcommon-cs/a_reset.c
@@ -138,6 +138,9 @@
 
        struct a_reset_ctx *reset;
 
+       if (strlen(name) >= sizeof(reset->name))
+               return NULL;
+
        /* Register the fsm description (if not already done) */
        if (osmo_fsm_find_by_name(fsm.name) != &fsm)
                osmo_fsm_register(&fsm);

-- 
To view, visit https://gerrit.osmocom.org/4716
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id7c4a7ff17e1c8ceb6e543ab6f0f07c87df603c7
Gerrit-PatchSet: 1
Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-Owner: dexter <pma...@sysmocom.de>

Reply via email to