[PATCH procd] ubus: add state measurement
Florian Eckert
fe at dev.tdt.de
Wed Mar 22 01:01:37 PDT 2023
Hello Oldrich,
>> +
>> +void procd_state_event(struct blob_buf *b)
>> +{
>> + void *c, *s;
>> + struct timespec *ts_start;
>> + struct timespec *ts_stop;
>> + struct timespec ts_active;
>> + struct timespec ts_res;
>> + double duration;
>> +
>> + c = blobmsg_open_table(b, "state");
>> +
>> + for (int i = 0; i < __STATE_MAX - 1; i++)
>> + {
>> + ts_start = &s_event[i].ts_event;
>> + ts_stop = &s_event[i+1].ts_event;
>
> Hi, this looks like out-of-bounds access for the last iteration.
>
I would say, this is ok, because the loop
'for (int i = 0; i < __STATE_MAX - 1; i++)' does 'i < __STATE_MAX - 1'
and so the STATE_HALT would never hit but could use the memory to read
ts_stop with 'ts_stop = &s_event[i+1].ts_event;'
Best regards
Florian
More information about the openwrt-devel
mailing list