Merge "diag: Prevent out-of-bound access while processing mask commands"

This commit is contained in:
Linux Build Service Account 2019-06-02 23:35:04 -07:00 committed by Gerrit - the friendly Code Review server
commit 16819b1724

View file

@ -2270,6 +2270,8 @@ int diag_process_apps_masks(unsigned char *buf, int len, int pid)
return -EINVAL;
if (*buf == DIAG_CMD_LOG_CONFIG) {
if (len < (2 * sizeof(int)))
return -EINVAL;
sub_cmd = *(int *)(buf + sizeof(int));
switch (sub_cmd) {
case DIAG_CMD_OP_LOG_DISABLE:
@ -2286,6 +2288,8 @@ int diag_process_apps_masks(unsigned char *buf, int len, int pid)
break;
}
} else if (*buf == DIAG_CMD_MSG_CONFIG) {
if (len < (2 * sizeof(uint8_t)))
return -EINVAL;
sub_cmd = *(uint8_t *)(buf + sizeof(uint8_t));
switch (sub_cmd) {
case DIAG_CMD_OP_GET_SSID_RANGE: