shared/nm-utils: avoid a coverity warning

1. NetworkManager-1.14.0/shared/nm-utils/nm-shared-utils.c:1242: value_overwrite: Overwriting previous write to "ch" with value from "v".
 2. NetworkManager-1.14.0/shared/nm-utils/nm-shared-utils.c:1239: assigned_value: Assigning value from "++str[0]" to "ch" here, but that stored value is overwritten before it can be used.
 #  1237|   				if (ch >= '0' && ch <= '7') {
 #  1238|   					v = v * 8 + (ch - '0');
 #  1239|-> 					ch = (++str)[0];
 #  1240|   				}
 #  1241|   			}

Don't assign ch when it is going to be overwritten.

(cherry picked from commit e4154895ff)
This commit is contained in:
Beniamino Galvani 2018-10-04 09:37:55 +02:00
parent 8cbc08ce29
commit 8fb85b1f5b

View file

@ -1236,7 +1236,7 @@ nm_utils_buf_utf8safe_unescape (const char *str, gsize *out_len, gpointer *to_fr
ch = (++str)[0];
if (ch >= '0' && ch <= '7') {
v = v * 8 + (ch - '0');
ch = (++str)[0];
++str;
}
}
ch = v;