Index: printutils.c =================================================================== --- printutils.c (revision 60410) +++ printutils.c (working copy) @@ -144,22 +144,23 @@ return buff; } +#define NENVSTRING 100 const char *EncodeEnvironment(SEXP x) { - static char ch[100]; + static char ch[NENVSTRING]; if (x == R_GlobalEnv) - sprintf(ch, ""); + snprintf(ch, NENVSTRING-1, ""); else if (x == R_BaseEnv) - sprintf(ch, ""); + snprintf(ch, NENVSTRING-1, ""); else if (x == R_EmptyEnv) - sprintf(ch, ""); + snprintf(ch, NENVSTRING-1, ""); else if (R_IsPackageEnv(x)) - sprintf(ch, "", + snprintf(ch, NENVSTRING-1, "", translateChar(STRING_ELT(R_PackageEnvName(x), 0))); else if (R_IsNamespaceEnv(x)) - sprintf(ch, "", + snprintf(ch, NENVSTRING-1, "", translateChar(STRING_ELT(R_NamespaceEnvSpec(x), 0))); - else sprintf(ch, "", (void *)x); + else snprintf(ch, NENVSTRING-1, "", (void *)x); return ch; }