Commit d9e8acc2 authored by Jonathan Hanks's avatar Jonathan Hanks
Browse files

Fix for FRS 9749.

Add a bounds check on reading the string for an enum.


git-svn-id: https://redoubt.ligo-wa.caltech.edu/svn/advLigoRTS/branches/advLigoRTS-3.2-frs-9749-fix@4643 6dcd42c9-f523-4c6d-aada-af552506706e
parent 668212f1
......@@ -2377,7 +2377,11 @@ void subscriptionHandler(struct event_handler_args args) {
if (entry->datatype == SDF_NUM) {
entry->data.chval = (double)(eVal->value);
} else {
strncpy(entry->data.strval, eVal->strs[eVal->value], MAX_STR_LEN);
if (eVal->value > 0 && eVal->value < eVal->no_str) {
strncpy(entry->data.strval, eVal->strs[eVal->value], MAX_STR_LEN);
} else {
snprintf(entry->data.strval, MAX_STR_LEN, "Unexpected enum value received - %d", (int)eVal->value);
}
entry->data.strval[MAX_STR_LEN - 1] = '\0';
}
// The dbr_gr_enum type does not have time information, so we use current time
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment