|
|
@@ -445,7 +445,11 @@ static int tipc_nl_compat_bearer_disable(struct tipc_nl_compat_cmd_doit *cmd,
|
|
|
if (!bearer)
|
|
|
return -EMSGSIZE;
|
|
|
|
|
|
- len = min_t(int, TLV_GET_DATA_LEN(msg->req), TIPC_MAX_BEARER_NAME);
|
|
|
+ len = TLV_GET_DATA_LEN(msg->req);
|
|
|
+ if (len <= 0)
|
|
|
+ return -EINVAL;
|
|
|
+
|
|
|
+ len = min_t(int, len, TIPC_MAX_BEARER_NAME);
|
|
|
if (!string_is_valid(name, len))
|
|
|
return -EINVAL;
|
|
|
|
|
|
@@ -537,7 +541,11 @@ static int tipc_nl_compat_link_stat_dump(struct tipc_nl_compat_msg *msg,
|
|
|
|
|
|
name = (char *)TLV_DATA(msg->req);
|
|
|
|
|
|
- len = min_t(int, TLV_GET_DATA_LEN(msg->req), TIPC_MAX_LINK_NAME);
|
|
|
+ len = TLV_GET_DATA_LEN(msg->req);
|
|
|
+ if (len <= 0)
|
|
|
+ return -EINVAL;
|
|
|
+
|
|
|
+ len = min_t(int, len, TIPC_MAX_BEARER_NAME);
|
|
|
if (!string_is_valid(name, len))
|
|
|
return -EINVAL;
|
|
|
|
|
|
@@ -815,7 +823,11 @@ static int tipc_nl_compat_link_reset_stats(struct tipc_nl_compat_cmd_doit *cmd,
|
|
|
if (!link)
|
|
|
return -EMSGSIZE;
|
|
|
|
|
|
- len = min_t(int, TLV_GET_DATA_LEN(msg->req), TIPC_MAX_LINK_NAME);
|
|
|
+ len = TLV_GET_DATA_LEN(msg->req);
|
|
|
+ if (len <= 0)
|
|
|
+ return -EINVAL;
|
|
|
+
|
|
|
+ len = min_t(int, len, TIPC_MAX_BEARER_NAME);
|
|
|
if (!string_is_valid(name, len))
|
|
|
return -EINVAL;
|
|
|
|