X-Git-Url: https://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=ncurses%2Ftinfo%2Fhome_terminfo.c;h=4521c4a8da685295fd04338a1841daa88f806630;hp=92c26705a016fb2b7ebaf12a7fbc4f9fac82f3c1;hb=11dead39816318fe9601e27756b9497caf7ff490;hpb=7a27c7d49c2e8b4a1ecbe85b4423d647cbc75ea5 diff --git a/ncurses/tinfo/home_terminfo.c b/ncurses/tinfo/home_terminfo.c index 92c26705..4521c4a8 100644 --- a/ncurses/tinfo/home_terminfo.c +++ b/ncurses/tinfo/home_terminfo.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2005,2007 Free Software Foundation, Inc. * + * Copyright (c) 1998-2007,2008 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -37,9 +37,7 @@ #include #include -MODULE_ID("$Id: home_terminfo.c,v 1.10 2007/04/21 23:11:53 tom Exp $") - -#define my_length (strlen(home) + sizeof(PRIVATE_INFO)) +MODULE_ID("$Id: home_terminfo.c,v 1.11 2008/08/03 23:43:11 tom Exp $") /* ncurses extension...fall back on user's private directory */ @@ -54,9 +52,9 @@ _nc_home_terminfo(void) if (use_terminfo_vars()) { if (MyBuffer == 0) { - if ((home = getenv("HOME")) != 0 - && my_length <= PATH_MAX) { - MyBuffer = typeMalloc(char, my_length); + if ((home = getenv("HOME")) != 0) { + unsigned want = (strlen(home) + sizeof(PRIVATE_INFO)); + MyBuffer = typeMalloc(char, want); if (MyBuffer == 0) _nc_err_abort(MSG_NO_MEMORY); (void) sprintf(MyBuffer, PRIVATE_INFO, home);