Skip to contentSkip to conversation

does "block: add secure discard" cause an overflow?

DISCUSSION Dan Carpenter 2 participants 2 messages Sep 3, 2010 – Sep 4, 2010

lore
Share & tools
lore
#0 lore raw

This is the commit 8d57a98ccd0b44 "block: add secure discard".

The patch adds a letter 'E' to the string in blk_fill_rwbs().
if (rw & REQ_SECURE)
rwbs[i++] = 'E';

The problem is that "rwbs" is a 6 character buffer and if all the flags are set the we'd get "WABSME" which would put us off the end (when you add the NUL terminator).

regards,
dan carpenter

#1 lore raw
Quoted 9 lines · Dan Carpenter

This is the commit 8d57a98ccd0b44 "block: add secure discard".

The patch adds a letter 'E' to the string in blk_fill_rwbs().
if (rw & REQ_SECURE)
rwbs[i++] = 'E';

The problem is that "rwbs" is a 6 character buffer and if all the flags are set the we'd get "WABSME" which would put us off the end (when you add the NUL terminator).

E goes with D which will not have either A or M, so there will not be a rwbs with E that has more than 5 characters.

Quoted 4 lines

regards,
dan carpenter