mirror of
https://github.com/systemd/systemd-stable.git
synced 2025-01-11 05:17:44 +03:00
tree-wide: port all calls to alloca() to alloca_safe()
This commit is contained in:
parent
5e76324eea
commit
698cec65c4
@ -365,7 +365,7 @@ static int open_ioctl_fd(int dev_autofs_fd, const char *where, dev_t devid) {
|
||||
assert(where);
|
||||
|
||||
l = sizeof(struct autofs_dev_ioctl) + strlen(where) + 1;
|
||||
param = alloca(l);
|
||||
param = alloca_safe(l);
|
||||
|
||||
init_autofs_dev_ioctl(param);
|
||||
param->size = l;
|
||||
|
@ -1874,13 +1874,13 @@ static int setup_keys(void) {
|
||||
return log_oom();
|
||||
|
||||
mpk_size = FSPRG_mskinbytes(FSPRG_RECOMMENDED_SECPAR);
|
||||
mpk = alloca(mpk_size);
|
||||
mpk = alloca_safe(mpk_size);
|
||||
|
||||
seed_size = FSPRG_RECOMMENDED_SEEDLEN;
|
||||
seed = alloca(seed_size);
|
||||
seed = alloca_safe(seed_size);
|
||||
|
||||
state_size = FSPRG_stateinbytes(FSPRG_RECOMMENDED_SECPAR);
|
||||
state = alloca(state_size);
|
||||
state = alloca_safe(state_size);
|
||||
|
||||
log_info("Generating seed...");
|
||||
r = genuine_random_bytes(seed, seed_size, RANDOM_BLOCK);
|
||||
|
@ -182,14 +182,13 @@ int journal_file_fsprg_seek(JournalFile *f, uint64_t goal) {
|
||||
} else {
|
||||
f->fsprg_state_size = FSPRG_stateinbytes(FSPRG_RECOMMENDED_SECPAR);
|
||||
f->fsprg_state = malloc(f->fsprg_state_size);
|
||||
|
||||
if (!f->fsprg_state)
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
log_debug("Seeking FSPRG key to %"PRIu64".", goal);
|
||||
|
||||
msk = alloca(FSPRG_mskinbytes(FSPRG_RECOMMENDED_SECPAR));
|
||||
msk = alloca_safe(FSPRG_mskinbytes(FSPRG_RECOMMENDED_SECPAR));
|
||||
FSPRG_GenMK(msk, NULL, f->fsprg_seed, f->fsprg_seed_size, FSPRG_RECOMMENDED_SECPAR);
|
||||
FSPRG_Seek(f->fsprg_state, goal, msk, f->fsprg_seed, f->fsprg_seed_size);
|
||||
return 0;
|
||||
|
@ -96,7 +96,7 @@ _public_ int sd_journal_printv(int priority, const char *format, va_list ap) {
|
||||
|
||||
/* Allocate large buffer to accommodate big message */
|
||||
if (len >= LINE_MAX) {
|
||||
buffer = alloca(len + 9);
|
||||
buffer = alloca_safe(len + 9);
|
||||
memcpy(buffer, "MESSAGE=", 8);
|
||||
assert_se(vsnprintf(buffer + 8, len + 1, format, ap) == len);
|
||||
}
|
||||
@ -472,7 +472,7 @@ _public_ int sd_journal_printv_with_location(int priority, const char *file, con
|
||||
|
||||
/* Allocate large buffer to accommodate big message */
|
||||
if (len >= LINE_MAX) {
|
||||
buffer = alloca(len + 9);
|
||||
buffer = alloca_safe(len + 9);
|
||||
memcpy(buffer, "MESSAGE=", 8);
|
||||
assert_se(vsnprintf(buffer + 8, len + 1, format, ap) == len);
|
||||
}
|
||||
|
@ -128,7 +128,7 @@ int fw_iptables_add_masquerade(
|
||||
mr->rangesize = 1;
|
||||
|
||||
/* Create a search mask entry */
|
||||
mask = alloca(sz);
|
||||
mask = alloca_safe(sz);
|
||||
memset(mask, 0xFF, sz);
|
||||
|
||||
if (add) {
|
||||
|
@ -35,7 +35,7 @@ static int nscd_flush_cache_one(const char *database, usec_t end) {
|
||||
l = strlen(database);
|
||||
req_size = offsetof(struct nscdInvalidateRequest, dbname) + l + 1;
|
||||
|
||||
req = alloca(req_size);
|
||||
req = alloca_safe(req_size);
|
||||
*req = (struct nscdInvalidateRequest) {
|
||||
.version = 2,
|
||||
.type = 10,
|
||||
|
Loading…
Reference in New Issue
Block a user