aboutsummaryrefslogtreecommitdiffstats
path: root/src/cfg_rcl.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2013-09-02 14:26:09 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2013-09-02 14:26:09 +0100
commit1f95ccccae7d0ef3ae431a8f26b86faeb5633491 (patch)
tree447b973e2661bd3a6a215bed61da66557e3b8c66 /src/cfg_rcl.c
parent722d8d6a974649067f7e60405487567344d930ec (diff)
downloadrspamd-1f95ccccae7d0ef3ae431a8f26b86faeb5633491.tar.gz
rspamd-1f95ccccae7d0ef3ae431a8f26b86faeb5633491.zip
Allow size_t values in parse_struct_integer.
Diffstat (limited to 'src/cfg_rcl.c')
-rw-r--r--src/cfg_rcl.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/src/cfg_rcl.c b/src/cfg_rcl.c
index 72e9d774a..b1c7a522c 100644
--- a/src/cfg_rcl.c
+++ b/src/cfg_rcl.c
@@ -391,6 +391,7 @@ rspamd_rcl_parse_struct_integer (struct config_file *cfg, rspamd_cl_object_t *ob
gint32 *i32p;
gint16 *i16p;
gint64 *i64p;
+ gsize *sp;
} target;
gint64 val;
@@ -402,21 +403,29 @@ rspamd_rcl_parse_struct_integer (struct config_file *cfg, rspamd_cl_object_t *ob
}
*target.i32p = val;
}
- else if (pd->flags == RSPAMD_CL_FLAG_INT_16) {
- target.i16p = (gint16 *)(((gchar *)pd->user_struct) + pd->offset);
+ else if (pd->flags == RSPAMD_CL_FLAG_INT_64) {
+ target.i64p = (gint64 *)(((gchar *)pd->user_struct) + pd->offset);
if (!rspamd_cl_obj_toint_safe (obj, &val)) {
g_set_error (err, CFG_RCL_ERROR, EINVAL, "cannot convert param to integer");
return FALSE;
}
- *target.i16p = val;
+ *target.i64p = val;
}
- else if (pd->flags == RSPAMD_CL_FLAG_INT_64) {
- target.i64p = (gint64 *)(((gchar *)pd->user_struct) + pd->offset);
+ else if (pd->flags == RSPAMD_CL_FLAG_SIZE) {
+ target.sp = (gsize *)(((gchar *)pd->user_struct) + pd->offset);
if (!rspamd_cl_obj_toint_safe (obj, &val)) {
g_set_error (err, CFG_RCL_ERROR, EINVAL, "cannot convert param to integer");
return FALSE;
}
- *target.i64p = val;
+ *target.sp = val;
+ }
+ else if (pd->flags == RSPAMD_CL_FLAG_INT_16) {
+ target.i16p = (gint16 *)(((gchar *)pd->user_struct) + pd->offset);
+ if (!rspamd_cl_obj_toint_safe (obj, &val)) {
+ g_set_error (err, CFG_RCL_ERROR, EINVAL, "cannot convert param to integer");
+ return FALSE;
+ }
+ *target.i16p = val;
}
else {
target.ip = (gint *)(((gchar *)pd->user_struct) + pd->offset);