summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/cfg_file.h2
-rw-r--r--src/cfg_utils.c6
-rw-r--r--src/cfg_xml.c14
-rw-r--r--src/cfg_xml.h1
4 files changed, 18 insertions, 5 deletions
diff --git a/src/cfg_file.h b/src/cfg_file.h
index f07539295..203558e9a 100644
--- a/src/cfg_file.h
+++ b/src/cfg_file.h
@@ -395,7 +395,7 @@ gchar* get_module_opt (struct config_file *cfg, gchar *module_name, gchar *opt_n
* @param limit string representation of limit (eg. 1M)
* @return numeric value of limit
*/
-gsize parse_limit (const gchar *limit, guint len);
+guint64 parse_limit (const gchar *limit, guint len);
/**
* Parse time
diff --git a/src/cfg_utils.c b/src/cfg_utils.c
index c872583f2..28430df14 100644
--- a/src/cfg_utils.c
+++ b/src/cfg_utils.c
@@ -300,10 +300,10 @@ get_module_opt (struct config_file *cfg, gchar *module_name, gchar *opt_name)
return NULL;
}
-gsize
+guint64
parse_limit (const gchar *limit, guint len)
{
- gsize result = 0;
+ guint64 result = 0;
const gchar *err_str;
if (!limit || *limit == '\0' || len == 0) {
@@ -311,7 +311,7 @@ parse_limit (const gchar *limit, guint len)
}
errno = 0;
- result = strtoul (limit, (gchar **)&err_str, 10);
+ result = strtoull (limit, (gchar **)&err_str, 10);
if (*err_str != '\0') {
/* Megabytes */
diff --git a/src/cfg_xml.c b/src/cfg_xml.c
index 8ecd7a986..ea0685ca4 100644
--- a/src/cfg_xml.c
+++ b/src/cfg_xml.c
@@ -1507,11 +1507,23 @@ xml_handle_size (struct config_file *cfg, struct rspamd_xml_userdata *ctx, GHash
gsize *dest;
dest = (gsize *)G_STRUCT_MEMBER_P (dest_struct, offset);
- *dest = parse_limit (data, -1);
+ *dest = (gsize)parse_limit (data, -1);
return TRUE;
}
+/* Guint64 variant */
+gboolean
+xml_handle_size_64 (struct config_file *cfg, struct rspamd_xml_userdata *ctx, GHashTable *attrs, gchar *data, gpointer user_data, gpointer dest_struct, gint offset)
+{
+ guint64 *dest;
+
+ dest = (guint64 *)G_STRUCT_MEMBER_P (dest_struct, offset);
+ *dest = parse_limit (data, -1);
+
+ return TRUE;
+}
+
gboolean
xml_handle_seconds (struct config_file *cfg, struct rspamd_xml_userdata *ctx, GHashTable *attrs, gchar *data, gpointer user_data, gpointer dest_struct, gint offset)
{
diff --git a/src/cfg_xml.h b/src/cfg_xml.h
index f1a1742d3..4e7f1481a 100644
--- a/src/cfg_xml.h
+++ b/src/cfg_xml.h
@@ -97,6 +97,7 @@ gboolean xml_handle_string_list (struct config_file *cfg, struct rspamd_xml_user
/* Numeric params */
gboolean xml_handle_size (struct config_file *cfg, struct rspamd_xml_userdata *ctx, GHashTable *attrs, gchar *data, gpointer user_data, gpointer dest_struct, gint offset);
+gboolean xml_handle_size_64 (struct config_file *cfg, struct rspamd_xml_userdata *ctx, GHashTable *attrs, gchar *data, gpointer user_data, gpointer dest_struct, gint offset);
gboolean xml_handle_double (struct config_file *cfg, struct rspamd_xml_userdata *ctx, GHashTable *attrs, gchar *data, gpointer user_data, gpointer dest_struct, gint offset);
gboolean xml_handle_seconds (struct config_file *cfg, struct rspamd_xml_userdata *ctx, GHashTable *attrs, gchar *data, gpointer user_data, gpointer dest_struct, gint offset);
gboolean xml_handle_int (struct config_file *cfg, struct rspamd_xml_userdata *ctx, GHashTable *attrs, gchar *data, gpointer user_data, gpointer dest_struct, gint offset);