X-Git-Url: https://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=progs%2Ftoe.c;h=f1b836fe277123bc31895a57e03d7a766bcbfdd7;hp=34216e954b8b8ec7fe1f2873a791943386798bd0;hb=18b7b94579f108e649ece3fb12165833dbf5d95a;hpb=292968cf29abc10835415a6352607b38ce7c9cbd diff --git a/progs/toe.c b/progs/toe.c index 34216e95..f1b836fe 100644 --- a/progs/toe.c +++ b/progs/toe.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2010,2011 Free Software Foundation, Inc. * + * Copyright (c) 1998-2011,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 * @@ -44,7 +44,7 @@ #include #endif -MODULE_ID("$Id: toe.c,v 1.64 2012/01/01 02:56:17 tom Exp $") +MODULE_ID("$Id: toe.c,v 1.67 2012/03/10 23:22:21 tom Exp $") #define isDotname(name) (!strcmp(name, ".") || !strcmp(name, "..")) @@ -236,10 +236,11 @@ make_db_name(char *dst, const char *src, unsigned limit) if (need <= limit) { if (size >= lens - && !strcmp(src + size - lens, suffix)) - (void) strcpy(dst, src); - else - (void) sprintf(dst, "%s%s", src, suffix); + && !strcmp(src + size - lens, suffix)) { + _nc_STRCPY(dst, src, PATH_MAX); + } else { + _nc_SPRINTF(dst, _nc_SLIMIT(PATH_MAX) "%s%s", src, suffix); + } result = TRUE; } return result; @@ -294,10 +295,10 @@ checksum_of(TERMTYPE *tp) unsigned i; for (i = 0; i < NUM_BOOLEANS(tp); i++) { - result += (tp->Booleans[i]); + result += (unsigned long) (tp->Booleans[i]); } for (i = 0; i < NUM_NUMBERS(tp); i++) { - result += (tp->Numbers[i]); + result += (unsigned long) (tp->Numbers[i]); } for (i = 0; i < NUM_STRINGS(tp); i++) { result += string_sum(tp->Strings[i]); @@ -387,7 +388,8 @@ typelist(int eargc, char *eargv[], if (isDotname(name_1)) continue; - (void) sprintf(cwd_buf, "%s/%.*s/", eargv[i], (int) len, name_1); + _nc_SPRINTF(cwd_buf, _nc_SLIMIT(cwd_len) + "%s/%.*s/", eargv[i], (int) len, name_1); if (chdir(cwd_buf) != 0) continue;