1
0
mirror of https://github.com/systemd/systemd.git synced 2024-12-23 21:35:11 +03:00

sd-device: use size_t for index in the loop

This commit is contained in:
Yu Watanabe 2021-01-26 20:35:53 +09:00
parent 61c0972dad
commit ce634c4a4d

View File

@ -448,7 +448,6 @@ int device_new_from_strv(sd_device **ret, char **strv) {
int device_new_from_nulstr(sd_device **ret, uint8_t *nulstr, size_t len) {
_cleanup_(sd_device_unrefp) sd_device *device = NULL;
const char *major = NULL, *minor = NULL;
unsigned i = 0;
int r;
assert(ret);
@ -459,11 +458,11 @@ int device_new_from_nulstr(sd_device **ret, uint8_t *nulstr, size_t len) {
if (r < 0)
return r;
while (i < len) {
for (size_t i = 0; i < len; ) {
char *key;
const char *end;
key = (char*)&nulstr[i];
key = (char*) &nulstr[i];
end = memchr(key, '\0', len - i);
if (!end)
return log_device_debug_errno(device, SYNTHETIC_ERRNO(EINVAL),