cmdline: check size of result buffer to avoid overflow
[libcmdline.git] / src / lib / cmdline_parse_string.h
index a91a5b5..d435f81 100644 (file)
@@ -65,7 +65,7 @@
 #include "cmdline_parse.h"
 
 /* size of a parsed string */
-#define STR_TOKEN_SIZE 128
+#define STR_TOKEN_SIZE CMDLINE_MAX_TOKEN_SIZE
 
 typedef char cmdline_fixed_string_t[STR_TOKEN_SIZE];
 
@@ -82,7 +82,7 @@ typedef struct cmdline_token_string cmdline_parse_token_string_t;
 extern struct cmdline_token_ops cmdline_token_string_ops;
 
 int cmdline_parse_string(cmdline_parse_token_hdr_t *tk, const char *srcbuf,
-                        void *res);
+                        void *res, unsigned ressize);
 int cmdline_complete_get_nb_string(cmdline_parse_token_hdr_t *tk);
 int cmdline_complete_get_elt_string(cmdline_parse_token_hdr_t *tk, int idx,
                                    char *dstbuf, unsigned int size);