mirror of
https://github.com/systemd/systemd.git
synced 2025-09-20 05:44:42 +03:00
Merge pull request #6846 from keszybz/fix-udev_event_apply_format
Fix udev_event_apply_format()
This commit is contained in:
@@ -2150,7 +2150,7 @@ int bus_exec_context_set_transient_property(
|
|||||||
|
|
||||||
m = exec_keyring_mode_from_string(s);
|
m = exec_keyring_mode_from_string(s);
|
||||||
if (m < 0)
|
if (m < 0)
|
||||||
return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Invalid key ring mode");
|
return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Invalid keyring mode");
|
||||||
|
|
||||||
if (mode != UNIT_CHECK) {
|
if (mode != UNIT_CHECK) {
|
||||||
c->keyring_mode = m;
|
c->keyring_mode = m;
|
||||||
|
@@ -2270,7 +2270,7 @@ static int setup_keyring(
|
|||||||
if (setregid(saved_gid, -1) < 0)
|
if (setregid(saved_gid, -1) < 0)
|
||||||
return log_error_errno(errno, "Failed to change GID back for user keyring: %m");
|
return log_error_errno(errno, "Failed to change GID back for user keyring: %m");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@@ -362,7 +362,7 @@ size_t udev_event_apply_format(struct udev_event *event,
|
|||||||
}
|
}
|
||||||
copy:
|
copy:
|
||||||
/* copy char */
|
/* copy char */
|
||||||
if (l == 0)
|
if (l < 2) /* need space for this char and the terminating NUL */
|
||||||
goto out;
|
goto out;
|
||||||
s[0] = from[0];
|
s[0] = from[0];
|
||||||
from++;
|
from++;
|
||||||
@@ -377,12 +377,12 @@ subst:
|
|||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
from++;
|
from++;
|
||||||
for (i = 0; from[i] != '}'; i++) {
|
for (i = 0; from[i] != '}'; i++)
|
||||||
if (from[i] == '\0') {
|
if (from[i] == '\0') {
|
||||||
log_error("missing closing brace for format '%s'", src);
|
log_error("missing closing brace for format '%s'", src);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (i >= sizeof(attrbuf))
|
if (i >= sizeof(attrbuf))
|
||||||
goto out;
|
goto out;
|
||||||
memcpy(attrbuf, from, i);
|
memcpy(attrbuf, from, i);
|
||||||
@@ -407,6 +407,7 @@ subst:
|
|||||||
}
|
}
|
||||||
|
|
||||||
out:
|
out:
|
||||||
|
assert(l >= 1);
|
||||||
s[0] = '\0';
|
s[0] = '\0';
|
||||||
return l;
|
return l;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user