/****************************************************************************
- * Copyright (c) 1998-2005,2007 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2010,2012 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 *
#include <curses.priv.h>
#include <tic.h>
-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.14 2012/02/22 22:40:24 tom Exp $")
/* ncurses extension...fall back on user's private directory */
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) {
+ size_t 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);
+ _nc_SPRINTF(MyBuffer, _nc_SLIMIT(want) PRIVATE_INFO, home);
}
}
result = MyBuffer;