1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2025-04-10 11:21:52 +00:00

Avoid out of bound memory access

Value of idx is -1, if find_match_op returns -1.
Later idx is used as index for accessing element of expr_dup
causing our of bound memory access.
This commit is contained in:
Mithil Poojary 2020-10-02 21:59:05 +05:30 committed by Brenden Matthews
parent 366c384bde
commit e9fcca035b

View File

@ -180,7 +180,7 @@ int compare(const char *expr) {
idx = find_match_op(expr);
mtype = get_match_type(expr);
if ((idx == 0) || mtype == -1) {
if ((idx <= 0) || mtype == -1) {
NORM_ERR("failed to parse compare string '%s'", expr);
return -2;
}