mirror of
https://github.com/MidnightCommander/mc
synced 2025-03-13 19:33:23 +03:00
* slerr.c (SLang_doerror): Fix possible off-by-one error.
* sltermin.c (_SLtt_tigetent): Likewise.
This commit is contained in:
parent
58d1d9fe2b
commit
3e0fee42ad
@ -1,3 +1,8 @@
|
|||||||
|
2003-09-11 Andrew V. Samoilov <sav@bcs.zp.ua>
|
||||||
|
|
||||||
|
* slerr.c (SLang_doerror): Fix possible off-by-one error.
|
||||||
|
* sltermin.c (_SLtt_tigetent): Likewise.
|
||||||
|
|
||||||
2002-11-28 Pavel Roskin <proski@gnu.org>
|
2002-11-28 Pavel Roskin <proski@gnu.org>
|
||||||
|
|
||||||
* sldisply.c: Fix for the previous patch. Only swap colors if
|
* sldisply.c: Fix for the previous patch. Only swap colors if
|
||||||
|
@ -78,24 +78,25 @@ void SLang_doerror (char *error)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
char *sle = "S-Lang Error: ";
|
char *sle = "S-Lang Error: ";
|
||||||
unsigned int len;
|
unsigned int len = 0;
|
||||||
char *fmt;
|
char *fmt = "%s%s%s";
|
||||||
|
|
||||||
str = get_error_string ();
|
str = get_error_string ();
|
||||||
|
|
||||||
fmt = "%s%s%s";
|
|
||||||
if ((error == NULL) || (*error == 0))
|
if ((error == NULL) || (*error == 0))
|
||||||
error = "";
|
error = "";
|
||||||
else if (SLang_Error == SL_UNKNOWN_ERROR)
|
else if (SLang_Error == SL_UNKNOWN_ERROR)
|
||||||
/* Do not display an unknown error message if error is non-NULL */
|
/* Do not display an unknown error message if error is non-NULL */
|
||||||
str = "";
|
str = "";
|
||||||
else
|
else {
|
||||||
fmt = "%s%s: %s";
|
fmt = "%s%s: %s";
|
||||||
|
len = 2; /* ": " */
|
||||||
|
}
|
||||||
|
|
||||||
len = strlen (sle) + strlen (str) + strlen(error) + 1;
|
len += strlen (sle) + strlen (str) + strlen(error) + 1 /* trailing 0 */;
|
||||||
|
|
||||||
err = err_buf;
|
err = err_buf;
|
||||||
if (len >= sizeof (err_buf))
|
if (len > sizeof (err_buf))
|
||||||
{
|
{
|
||||||
if (NULL == (malloced_err_buf = SLmalloc (len)))
|
if (NULL == (malloced_err_buf = SLmalloc (len)))
|
||||||
err = NULL;
|
err = NULL;
|
||||||
|
@ -283,7 +283,7 @@ SLterminfo_Type *_SLtt_tigetent (char *term)
|
|||||||
if (*tidir == 0)
|
if (*tidir == 0)
|
||||||
break; /* last one */
|
break; /* last one */
|
||||||
|
|
||||||
if (sizeof (file) > strlen (tidir) + 2 + strlen (term))
|
if (sizeof (file) >= strlen (tidir) + 4 + strlen (term))
|
||||||
{
|
{
|
||||||
sprintf (file, "%s/%c/%s", tidir, *term, term);
|
sprintf (file, "%s/%c/%s", tidir, *term, term);
|
||||||
if (NULL != (fp = open_terminfo (file, ti)))
|
if (NULL != (fp = open_terminfo (file, ti)))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user