]> ncurses.scripts.mit.edu Git - ncurses.git/blobdiff - ncurses/tinfo/captoinfo.c
ncurses 5.6 - patch 20080804
[ncurses.git] / ncurses / tinfo / captoinfo.c
index 0e3baa845693268f84b1023dd6617649cce86d4b..ef68b04d5d90f4920a2f0cc82d218cbe0079bcd4 100644 (file)
@@ -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.51 2008/08/03 18:35:47 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;
@@ -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;