Skip to contentSkip to conversation

ALSA: vx_core: off by one in vx_read_status()

PATCH In review Dan Carpenter 2 participants 2 messages Jun 21, 2013

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ALSA: vx_core: off by one in vx_read_status()

This code is older than git, and I haven't tested it, but if size = SIZE_MAX_STATUS then we would write one space past the end of the rmh->Stat[] array.

sound/drivers/vx/vx_core.c +1 -1
index c39961c..8359689 100644
@@ -205,7 +205,7 @@ static int vx_read_status(struct vx_core *chip, struct vx_rmh *rmh)
 
 	if (size < 1)
 		return 0;
-	if (snd_BUG_ON(size > SIZE_MAX_STATUS))
+	if (snd_BUG_ON(size >= SIZE_MAX_STATUS))
 		return -EINVAL;
 
 	for (i = 1; i <= size; i++) {
#1 lore raw

At Fri, 21 Jun 2013 15:25:33 +0300,

Quoted 6 lines · Dan Carpenter

This code is older than git, and I haven't tested it, but if size == SIZE_MAX_STATUS then we would write one space past the end of the rmh->Stat[] array.

Yes, the patch looks correct. Applied now.
Thanks.

Takashi

Quoted 14 lines
sound/drivers/vx/vx_core.c +1 -1
index c39961c..8359689 100644
@@ -205,7 +205,7 @@ static int vx_read_status(struct vx_core *chip, struct vx_rmh *rmh)
 
 	if (size < 1)
 		return 0;
-	if (snd_BUG_ON(size > SIZE_MAX_STATUS))
+	if (snd_BUG_ON(size >= SIZE_MAX_STATUS))
 		return -EINVAL;
 
 	for (i = 1; i <= size; i++) {