Skip to content

Commit

Permalink
mi_datagram: prevent socket overflow
Browse files Browse the repository at this point in the history
Fixes coverity CID 150493
  • Loading branch information
razvancrainea committed Oct 24, 2016
1 parent 07361e6 commit 7e9744a
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions modules/mi_datagram/mi_datagram.c
Expand Up @@ -247,6 +247,13 @@ static int mi_mod_init(void)
return -1;
}
}
/* prevent buffer overflow */
n = strlen(mi_socket);
if (n > sizeof(mi_dtgram_addr.unix_addr.sun_path)) {
LM_ERR("socket name too long: %d - should be less than %d chars\n",
n, (int)sizeof(mi_dtgram_addr.unix_addr.sun_path));
return -1;
}

/*create the unix socket address*/
mi_dtgram_addr.unix_addr.sun_family = AF_LOCAL;
Expand Down

0 comments on commit 7e9744a

Please sign in to comment.