Skip to content

Commit

Permalink
rpmsgdev: devpath may exceed RPMSG_NAME_SIZE
Browse files Browse the repository at this point in the history
Signed-off-by: yintao <[email protected]>
  • Loading branch information
yintao authored and xiaoxiang781216 committed Sep 28, 2024
1 parent 190fdd1 commit f45eaa6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 3 additions & 0 deletions drivers/misc/rpmsgdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -1160,6 +1160,9 @@ int rpmsgdev_register(FAR const char *remotecpu, FAR const char *remotepath,
return -EINVAL;
}

DEBUGASSERT(strlen(remotepath) + RPMSGDEV_NAME_PREFIX_LEN <=
RPMSG_NAME_SIZE);

dev = kmm_zalloc(sizeof(*dev));
if (dev == NULL)
{
Expand Down
4 changes: 2 additions & 2 deletions drivers/misc/rpmsgdev.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
* Pre-processor definitions
****************************************************************************/

#define RPMSGDEV_NAME_PREFIX "rpmsgdev-"
#define RPMSGDEV_NAME_PREFIX_LEN 9
#define RPMSGDEV_NAME_PREFIX "rpdev-"
#define RPMSGDEV_NAME_PREFIX_LEN 6

#define RPMSGDEV_OPEN 1
#define RPMSGDEV_CLOSE 2
Expand Down

0 comments on commit f45eaa6

Please sign in to comment.