#define ETH_RING_ACTION_CREATE "CREATE"
#define ETH_RING_ACTION_ATTACH "ATTACH"
#define ETH_RING_INTERNAL_ARG "internal"
+#define ETH_RING_INTERNAL_ARG_MAX_LEN 19 /* "0x..16chars..\0" */
static const char *valid_arguments[] = {
ETH_RING_NUMA_NODE_ACTION_ARG,
{
struct ring_internal_args **internal_args = data;
void *args;
+ int ret, n;
- sscanf(value, "%p", &args);
+ /* make sure 'value' is valid pointer length */
+ if (strnlen(value, ETH_RING_INTERNAL_ARG_MAX_LEN) >=
+ ETH_RING_INTERNAL_ARG_MAX_LEN) {
+ PMD_LOG(ERR, "Error parsing internal args, argument is too long");
+ return -1;
+ }
+
+ ret = sscanf(value, "%p%n", &args, &n);
+ if (ret == 0 || (size_t)n != strlen(value)) {
+ PMD_LOG(ERR, "Error parsing internal args");
+
+ return -1;
+ }
*internal_args = args;