From: David Carlier Date: Sat, 14 Feb 2026 13:24:04 +0000 (+0000) Subject: MINOR: deviceatlas: check getproptype return and remove pprop indirection X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8031bf6e03fa443abc386fa25b60b8e6ed55442a;p=thirdparty%2Fhaproxy.git MINOR: deviceatlas: check getproptype return and remove pprop indirection Check the return value of da_atlas_getproptype() and skip the property on failure instead of using an uninitialized proptype. Also remove the unnecessary pprop pointer indirection, using prop directly. --- diff --git a/addons/deviceatlas/da.c b/addons/deviceatlas/da.c index 676d4222c..c5d558521 100644 --- a/addons/deviceatlas/da.c +++ b/addons/deviceatlas/da.c @@ -324,7 +324,7 @@ static void da_haproxy_checkinst(void) static int da_haproxy(const struct arg *args, struct sample *smp, da_deviceinfo_t *devinfo) { struct buffer *tmp; - da_propid_t prop, *pprop; + da_propid_t prop; da_status_t status; da_type_t proptype; const char *propname; @@ -344,13 +344,15 @@ static int da_haproxy(const struct arg *args, struct sample *smp, da_deviceinfo_ chunk_appendf(tmp, "%c", global_deviceatlas.separator); continue; } - pprop = ∝ - da_atlas_getproptype(&global_deviceatlas.atlas, *pprop, &proptype); + if (unlikely(da_atlas_getproptype(&global_deviceatlas.atlas, prop, &proptype) != DA_OK)) { + chunk_appendf(tmp, "%c", global_deviceatlas.separator); + continue; + } switch (proptype) { case DA_TYPE_BOOLEAN: { bool val; - status = da_getpropboolean(devinfo, *pprop, &val); + status = da_getpropboolean(devinfo, prop, &val); if (status == DA_OK) { chunk_appendf(tmp, "%d", val); } @@ -359,7 +361,7 @@ static int da_haproxy(const struct arg *args, struct sample *smp, da_deviceinfo_ case DA_TYPE_INTEGER: case DA_TYPE_NUMBER: { long val; - status = da_getpropinteger(devinfo, *pprop, &val); + status = da_getpropinteger(devinfo, prop, &val); if (status == DA_OK) { chunk_appendf(tmp, "%ld", val); } @@ -367,7 +369,7 @@ static int da_haproxy(const struct arg *args, struct sample *smp, da_deviceinfo_ } case DA_TYPE_STRING: { const char *val; - status = da_getpropstring(devinfo, *pprop, &val); + status = da_getpropstring(devinfo, prop, &val); if (status == DA_OK) { chunk_appendf(tmp, "%s", val); }