Skip to content

Commit

Permalink
parisc: Fix read buffer overflow in pdc_stable driver
Browse files Browse the repository at this point in the history
Check whether index is within bounds before testing the element.

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Signed-off-by: Helge Deller <deller@gmx.de>
  • Loading branch information
Roel Kluin authored and Helge Deller committed Aug 2, 2009
1 parent b4f2e2a commit 447c233
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/parisc/pdc_stable.c
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ pdcspath_layer_read(struct pdcspath_entry *entry, char *buf)
if (!i) /* entry is not ready */
return -ENODATA;

for (i = 0; devpath->layers[i] && (likely(i < 6)); i++)
for (i = 0; i < 6 && devpath->layers[i]; i++)
out += sprintf(out, "%u ", devpath->layers[i]);

out += sprintf(out, "\n");
Expand Down

0 comments on commit 447c233

Please sign in to comment.