mirror of
https://github.com/systemd/systemd.git
synced 2026-08-04 15:10:33 +00:00
nss-myhostname: use INC_SAFE for buffer index accumulation
Use overflow-safe INC_SAFE() instead of raw addition for idx
accumulation, so that Coverity can see the addition is checked.
CID#1548028
Follow-up for a05483a921
This commit is contained in:
@@ -238,14 +238,10 @@ static enum nss_status fill_in_hostent(
|
||||
if (additional) {
|
||||
((char**) r_aliases)[0] = r_alias;
|
||||
((char**) r_aliases)[1] = NULL;
|
||||
/* Silence static analyzers */
|
||||
assert(idx <= buflen - 2 * sizeof(char*));
|
||||
idx += 2*sizeof(char*);
|
||||
assert_se(INC_SAFE(&idx, 2 * sizeof(char*)));
|
||||
} else {
|
||||
((char**) r_aliases)[0] = NULL;
|
||||
/* Silence static analyzers */
|
||||
assert(idx <= buflen - sizeof(char*));
|
||||
idx += sizeof(char*);
|
||||
assert_se(INC_SAFE(&idx, sizeof(char*)));
|
||||
}
|
||||
|
||||
/* Third, add addresses */
|
||||
|
||||
Reference in New Issue
Block a user