diff options
author | Beniamino Galvani <bgalvani@redhat.com> | 2018-10-04 09:37:55 +0200 |
---|---|---|
committer | Beniamino Galvani <bgalvani@redhat.com> | 2018-10-06 10:03:48 +0200 |
commit | df48bd6f4d9c8c2ce881a470ab4ffda7233d72b2 (patch) | |
tree | 95d21c0b605fa64bb65a56cbf31957f4b466d7e9 | |
parent | aabbbf243a1cfbc160ec684cd39e2f3a4a700d90 (diff) |
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.
-rw-r--r-- | shared/nm-utils/nm-shared-utils.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/shared/nm-utils/nm-shared-utils.c b/shared/nm-utils/nm-shared-utils.c index 53da84280..2ace30984 100644 --- a/shared/nm-utils/nm-shared-utils.c +++ b/shared/nm-utils/nm-shared-utils.c @@ -1222,7 +1222,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; |