Skip to content

Commit

Permalink
staging: tidspbridge: fix potential array out of bounds write
Browse files Browse the repository at this point in the history
The name of the firmware (drv_datap->base_img) could potentially
become equal to 255 valid characters (size of exec_file), this
will result in an out of bounds write, given that the 255 chars
along with a '\0' terminator will be copied into an array of
255 chars.

Produce an error on this cases, because the driver expects the NULL
ending to be among the 255 char limit.

Reported-by: Chen Gang <gang.chen@asianux.com>
Signed-off-by: Omar Ramirez Luna <omar.ramirez@copitl.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Omar Ramirez Luna authored and Greg Kroah-Hartman committed Jan 18, 2013
1 parent f14287b commit 7c25664
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/staging/tidspbridge/rmgr/proc.c
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ static int get_exec_file(struct cfg_devnode *dev_node_obj,
if (!drv_datap || !drv_datap->base_img)
return -EFAULT;

if (strlen(drv_datap->base_img) > size)
if (strlen(drv_datap->base_img) >= size)
return -EINVAL;

strcpy(exec_file, drv_datap->base_img);
Expand Down

0 comments on commit 7c25664

Please sign in to comment.