Re: [PATCH] uml: handle unusual results from find_tempdir.
On Tue, Feb 05, 2008 at 05:25:06PM +0100, Jim Meyering wrote: > > An alternative: make find_tempdir set tempdir to default_tempdir > upon malloc failure. > > * arch/um/os-Linux/mem.c (make_tempfile): Handle NULL tempdir. > Don't let a long tempdir (e.g., via TMPDIR) provoke heap corruption. > > Signed-off-by: Jim Meyering <[EMAIL PROTECTED]> Thanks, I'll forward this on. Jeff -- Work email - jdike at linux dot intel dot com -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] uml: handle unusual results from find_tempdir.
An alternative: make find_tempdir set tempdir to default_tempdir upon malloc failure. * arch/um/os-Linux/mem.c (make_tempfile): Handle NULL tempdir. Don't let a long tempdir (e.g., via TMPDIR) provoke heap corruption. Signed-off-by: Jim Meyering <[EMAIL PROTECTED]> --- arch/um/os-Linux/mem.c |3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/arch/um/os-Linux/mem.c b/arch/um/os-Linux/mem.c index e114d09..1458385 100644 --- a/arch/um/os-Linux/mem.c +++ b/arch/um/os-Linux/mem.c @@ -176,6 +176,9 @@ int __init make_tempfile(const char *template, char **out_tempname, return -1; find_tempdir(); + if (tempdir == NULL || strlen(tempdir) >= MAXPATHLEN) + return -1; + if (template[0] != '/') strcpy(tempname, tempdir); else -- 1.5.4.19.gd3dfd -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] uml: handle unusual results from find_tempdir.
An alternative: make find_tempdir set tempdir to default_tempdir upon malloc failure. * arch/um/os-Linux/mem.c (make_tempfile): Handle NULL tempdir. Don't let a long tempdir (e.g., via TMPDIR) provoke heap corruption. Signed-off-by: Jim Meyering [EMAIL PROTECTED] --- arch/um/os-Linux/mem.c |3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/arch/um/os-Linux/mem.c b/arch/um/os-Linux/mem.c index e114d09..1458385 100644 --- a/arch/um/os-Linux/mem.c +++ b/arch/um/os-Linux/mem.c @@ -176,6 +176,9 @@ int __init make_tempfile(const char *template, char **out_tempname, return -1; find_tempdir(); + if (tempdir == NULL || strlen(tempdir) = MAXPATHLEN) + return -1; + if (template[0] != '/') strcpy(tempname, tempdir); else -- 1.5.4.19.gd3dfd -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] uml: handle unusual results from find_tempdir.
On Tue, Feb 05, 2008 at 05:25:06PM +0100, Jim Meyering wrote: An alternative: make find_tempdir set tempdir to default_tempdir upon malloc failure. * arch/um/os-Linux/mem.c (make_tempfile): Handle NULL tempdir. Don't let a long tempdir (e.g., via TMPDIR) provoke heap corruption. Signed-off-by: Jim Meyering [EMAIL PROTECTED] Thanks, I'll forward this on. Jeff -- Work email - jdike at linux dot intel dot com -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/