[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [lvm-devel] stack smash?

On Mon, Aug 06, 2007 at 09:17:21PM +0200, Jim Meyering wrote:
> Caveat: There may well be code somewhere that ensures ->path_live is so
> much shorter than PATH_MAX that this is a non-issue.  But if that's the
> case, please let me know and instead, I'll add a comment or some sort
> of assertion here to that effect.
Can you fix this at source?  i.e. Add a path size restriction when the original
string is read from the config file, after allowing for the maximum permitted
vgname (NAME_LEN) and suffix.

> Assuming this patch is on the right track (yes, I'll test first),
> any preference on where to #define MIN?  

It's sad this has never made it into a standard include file, but there
are numerous instances of it under /usr/include.

How about adopting the linux kernel version of this with its enforced type

> Obviously, it doesn't belong in this file.
Could include in the new util.h?

>  	if (strcmp(slash, vg->name)) {
> +		char new_name[PATH_MAX];

We define all variables at the top of the function.
If there's a strong feeling a variable should be defined locally to a block,
then instead we split the block out into a separate function.

agk redhat com

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]