utils: fix out-of-bound access for negative indexes in _NM_UTILS_STRING_LOOKUP_TABLE_DEFINE()
This commit is contained in:
@@ -267,7 +267,7 @@ fcn_name (lookup_type idx) \
|
|||||||
static const char *const descs[] = { \
|
static const char *const descs[] = { \
|
||||||
__VA_ARGS__ \
|
__VA_ARGS__ \
|
||||||
}; \
|
}; \
|
||||||
if ((gssize) idx >= 0 && idx < G_N_ELEMENTS (descs)) \
|
if ((gsize) idx < G_N_ELEMENTS (descs)) \
|
||||||
return descs[idx]; \
|
return descs[idx]; \
|
||||||
return unknown_val; \
|
return unknown_val; \
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user