
> #define ARRAY_INDEX_SAFE(i, max) ((i) < (max) ? (i) : ((max) - 1))
> // ...
>     app_reply->elem[ARRAY_INDEX_SAFE(pcnt, app_req.num_ports)].rekey_count =
