mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-07 17:28:15 +00:00
Remove VIR_STRNDUP usage with checked pointers
Remove the usage where sanity of the length argument is verified by other conditions not matching the previous patches. Signed-off-by: Ján Tomko <jtomko@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
997340588b
commit
7318bff551
@ -815,9 +815,8 @@ xenParseSxprChar(const char *value,
|
|||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (offset != value &&
|
if (offset != value)
|
||||||
VIR_STRNDUP(def->source->data.tcp.host, value, offset - value) < 0)
|
def->source->data.tcp.host = g_strndup(value, offset - value);
|
||||||
goto error;
|
|
||||||
|
|
||||||
offset2 = strchr(offset, ',');
|
offset2 = strchr(offset, ',');
|
||||||
offset++;
|
offset++;
|
||||||
@ -843,9 +842,9 @@ xenParseSxprChar(const char *value,
|
|||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (offset != value &&
|
if (offset != value)
|
||||||
VIR_STRNDUP(def->source->data.udp.connectHost, value, offset - value) < 0)
|
def->source->data.udp.connectHost = g_strndup(value,
|
||||||
goto error;
|
offset - value);
|
||||||
|
|
||||||
offset2 = strchr(offset, '@');
|
offset2 = strchr(offset, '@');
|
||||||
if (offset2 != NULL) {
|
if (offset2 != NULL) {
|
||||||
@ -860,10 +859,9 @@ xenParseSxprChar(const char *value,
|
|||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (offset3 > (offset2 + 1) &&
|
if (offset3 > (offset2 + 1))
|
||||||
VIR_STRNDUP(def->source->data.udp.bindHost,
|
def->source->data.udp.bindHost = g_strndup(offset2 + 1,
|
||||||
offset2 + 1, offset3 - offset2 - 1) < 0)
|
offset3 - offset2 - 1);
|
||||||
goto error;
|
|
||||||
|
|
||||||
def->source->data.udp.bindService = g_strdup(offset3 + 1);
|
def->source->data.udp.bindService = g_strdup(offset3 + 1);
|
||||||
} else {
|
} else {
|
||||||
|
@ -348,9 +348,8 @@ vshCmddefCheckInternals(vshControl *ctl,
|
|||||||
cmd->name);
|
cmd->name);
|
||||||
return -1; /* alias options are tracked by the original name */
|
return -1; /* alias options are tracked by the original name */
|
||||||
}
|
}
|
||||||
if ((p = strchr(name, '=')) &&
|
if ((p = strchr(name, '=')))
|
||||||
VIR_STRNDUP(name, name, p - name) < 0)
|
name = g_strndup(name, p - name);
|
||||||
return -1;
|
|
||||||
for (j = i + 1; cmd->opts[j].name; j++) {
|
for (j = i + 1; cmd->opts[j].name; j++) {
|
||||||
if (STREQ(name, cmd->opts[j].name) &&
|
if (STREQ(name, cmd->opts[j].name) &&
|
||||||
cmd->opts[j].type != VSH_OT_ALIAS)
|
cmd->opts[j].type != VSH_OT_ALIAS)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user