Commit 7afb6d8
jbd2: Avoid printing outside the boundary of the buffer
Theoretically possible that "%pg" will take all room for the j_devname
and hence the "-%lu" will go outside the boundary due to unconditional
sprintf() in use. To make this code more robust, replace two sequential
s*printf():s by a single call and then replace forbidden character.
It's possible to do this way, because '/' won't ever be in the result
of "-%lu".
Reviewed-by: Jan Kara <jack@suse.cz>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Kees Cook <keescook@chromium.org>
Link: https://lore.kernel.org/r/20230605170553.7835-2-andriy.shevchenko@linux.intel.com1 parent 8515e4a commit 7afb6d8
1 file changed
Lines changed: 2 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1491 | 1491 | | |
1492 | 1492 | | |
1493 | 1493 | | |
1494 | | - | |
1495 | 1494 | | |
1496 | 1495 | | |
1497 | 1496 | | |
| |||
1515 | 1514 | | |
1516 | 1515 | | |
1517 | 1516 | | |
1518 | | - | |
1519 | | - | |
1520 | | - | |
| 1517 | + | |
| 1518 | + | |
1521 | 1519 | | |
1522 | 1520 | | |
1523 | 1521 | | |
| |||
0 commit comments