Skip to contentSkip to conversation

Fix string overflow in pp_hds_modular

PATCH New Hannes Reinecke 1 participant 1 message Aug 6, 2007 Device mapper

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix string overflow in pp_hds_modular

Hi Christophe,

our build checker detected a string overflow in pp_hds_modular. One shouldn't really write 9 bytes into a 8 byte string ...

Cheers,

Hannes

Signature · 4 lines
Dr. Hannes Reinecke		      zSeries & Storage
[email protected]			      +49 911 74053 688
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: Markus Rex, HRB 16746 (AG Nürnberg)

tree d0feb33b9e79f82c08ba54e3232ff74e3d0a3e92 parent 5ac8944b746a19c2c08e96d9c91c5b00eb0ef95e author Hannes Reinecke <[email protected]> 1186052416 +0200 committer Hannes Reinecke <[email protected]> 1186052416 +0200

pp_hds_modular: Fix buffer overflow

'vendor' is defined to hold 8 bytes, yet snprintf tries to write 9 bytes to it. Bad.

a04c8abdc0da9556ac4ccedacef3ca41f0aceeb9

 path_priority/pp_hds_modular/pp_hds_modular.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
path_priority/pp_hds_modular/pp_hds_modular.c +1 -1
index 7411508..10b28b8 100644
@@ -120,7 +120,7 @@ int main (int argc, char **argv)
 int hds_modular_prio (const char *dev)
 {
 	int sg_fd, k;
-	char vendor[8];
+	char vendor[9];
 	char product[32];
 	char serial[32];
 	char ldev[32];