Re: [PATCH] ext4: Prevent stack overrun in ext4_file_open when recording last known mountpoint
From: Andi Kleen
Date: Fri Sep 16 2011 - 13:54:39 EST
"Darrick J. Wong" <djwong@xxxxxxxxxx> writes:
> Writing stack variables into the superblock doesn't sound like a great idea, so
> use strncpy instead.
This means you can end up with a non 0 terminated path in the
superblock, which could confuse programs.
Better use strlcpy()
strncpy is usually a bad idea, it's semantics overall are quite
bogus and it's also inefficient because it always fills.
-Andi
--
ak@xxxxxxxxxxxxxxx -- Speaking for myself only
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/