Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-15-SP3:Update
slurm
U_11-Return-earlier-if-no-elements-in-array.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File U_11-Return-earlier-if-no-elements-in-array.patch of Package slurm
From: Tim Wickberg <tim@schedmd.com> Date: Tue Nov 28 23:34:06 2023 -0700 Subject: [PATCH 11/28]Return earlier if no elements in array. Patch-mainline: Upstream Git-repo: https://github.com/SchedMD/slurm Git-commit: f5e5afccdac467fba77937b950fe58c2a098adc4 References: bsc#1218046, bsc#1218050, bsc#1218051, bsc#1218053 Signed-off-by: Egbert Eich <eich@suse.de> Signed-off-by: Egbert Eich <eich@suse.com> --- src/common/pack.c | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/src/common/pack.c b/src/common/pack.c index 7015665ab6..53662442b5 100644 --- a/src/common/pack.c +++ b/src/common/pack.c @@ -1081,24 +1081,28 @@ int unpackstr_array(char ***valp, uint32_t * size_valp, Buf buffer) *valp = NULL; safe_unpack32(size_valp, buffer); + if (!*size_valp) + return SLURM_SUCCESS; + if (*size_valp > MAX_ARRAY_LEN_MEDIUM) { error("%s: Buffer to be unpacked is too large (%u > %u)", __func__, *size_valp, MAX_ARRAY_LEN_MEDIUM); return SLURM_ERROR; } - else if (*size_valp > 0) { - safe_xcalloc(*valp, *size_valp + 1, sizeof(char *)); - for (i = 0; i < *size_valp; i++) { - if (unpackstr_xmalloc(&(*valp)[i], &uint32_tmp, buffer)) { - *size_valp = 0; - xfree_array(*valp); - return SLURM_ERROR; + + safe_xcalloc(*valp, *size_valp + 1, sizeof(char *)); + for (i = 0; i < *size_valp; i++) { + if (unpackstr_xmalloc(&(*valp)[i], &uint32_tmp, buffer)) { + *size_valp = 0; + xfree_array(*valp); + return SLURM_ERROR; } - /* - * NULL terminate array so execle() can detect end of array - */ - (*valp)[i] = NULL; } + /* + * NULL terminate array so execle() can detect end of array + */ + (*valp)[i] = NULL; + return SLURM_SUCCESS; unpack_error:
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor