aboutsummaryrefslogtreecommitdiff
path: root/ncurses/tinfo/captoinfo.c
diff options
context:
space:
mode:
authorRong-En Fan <rafan@FreeBSD.org>2008-11-09 14:08:54 +0000
committerRong-En Fan <rafan@FreeBSD.org>2008-11-09 14:08:54 +0000
commit6181f4622a00a9de81df01cecb5fa73ffdb697bc (patch)
treec963ba08ac935d7f048b78517309fe6fc2f496e6 /ncurses/tinfo/captoinfo.c
parentc0e48ca1322e978a8f9795a5ddb251df2479f930 (diff)
downloadsrc-6181f4622a00a9de81df01cecb5fa73ffdb697bc.tar.gz
src-6181f4622a00a9de81df01cecb5fa73ffdb697bc.zip
- Import ncurses 5.7-20081102 (5.7 release) onto vendor branchvendor/ncurses/5.7-20081102
Notes
Notes: svn path=/vendor/ncurses/dist/; revision=184798 svn path=/vendor/ncurses/5.7-20081102/; revision=184799; tag=vendor/ncurses/5.7-20081102
Diffstat (limited to 'ncurses/tinfo/captoinfo.c')
-rw-r--r--ncurses/tinfo/captoinfo.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/ncurses/tinfo/captoinfo.c b/ncurses/tinfo/captoinfo.c
index 0e3baa845693..93300c1be3e4 100644
--- a/ncurses/tinfo/captoinfo.c
+++ b/ncurses/tinfo/captoinfo.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2005,2006 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2006,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 *
@@ -93,7 +93,7 @@
#include <ctype.h>
#include <tic.h>
-MODULE_ID("$Id: captoinfo.c,v 1.49 2006/12/16 19:16:53 tom Exp $")
+MODULE_ID("$Id: captoinfo.c,v 1.52 2008/08/16 19:24:51 tom Exp $")
#define MAX_PUSHED 16 /* max # args we can push onto the stack */
@@ -149,7 +149,7 @@ static void
push(void)
/* push onstack on to the stack */
{
- if (stackptr > MAX_PUSHED)
+ if (stackptr >= MAX_PUSHED)
_nc_warning("string too complex to convert");
else
stack[stackptr++] = onstack;
@@ -183,7 +183,7 @@ cvtchar(register const char *sp)
case '$':
case '\\':
case '%':
- c = *sp;
+ c = (unsigned char) (*sp);
len = 2;
break;
case '\0':
@@ -201,7 +201,7 @@ cvtchar(register const char *sp)
}
break;
default:
- c = *sp;
+ c = (unsigned char) (*sp);
len = 2;
break;
}
@@ -211,7 +211,7 @@ cvtchar(register const char *sp)
len = 2;
break;
default:
- c = *sp;
+ c = (unsigned char) (*sp);
len = 1;
}
if (isgraph(c) && c != ',' && c != '\'' && c != '\\' && c != ':') {
@@ -788,6 +788,11 @@ _nc_infotocap(const char *cap GCC_UNUSED, const char *str, int const parameteriz
} /* endswitch (*str) */
} /* endelse (*str == '%') */
+ /*
+ * 'str' always points to the end of what was scanned in this step,
+ * but that may not be the end of the string.
+ */
+ assert(str != 0);
if (*str == '\0')
break;