]> ncurses.scripts.mit.edu Git - ncurses.git/blobdiff - ncurses/tinfo/lib_tgoto.c
ncurses 6.0 - patch 20170812
[ncurses.git] / ncurses / tinfo / lib_tgoto.c
index 37553f712394c2718ac6260db5c787adc6cd9cf2..31daf443624f4405709a348650a5024c41b4cdd2 100644 (file)
@@ -1,5 +1,5 @@
 /****************************************************************************
 /****************************************************************************
- * Copyright (c) 2000-2003,2006 Free Software Foundation, Inc.              *
+ * Copyright (c) 2000-2008,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            *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -35,7 +35,7 @@
 #include <ctype.h>
 #include <termcap.h>
 
 #include <ctype.h>
 #include <termcap.h>
 
-MODULE_ID("$Id: lib_tgoto.c,v 1.12 2006/11/26 00:26:24 tom Exp $")
+MODULE_ID("$Id: lib_tgoto.c,v 1.16 2012/02/24 02:08:08 tom Exp $")
 
 #if !PURE_TERMINFO
 static bool
 
 #if !PURE_TERMINFO
 static bool
@@ -128,7 +128,7 @@ tgoto_internal(const char *string, int x, int y)
                        *value = 0200;  /* tputs will treat this as \0 */
                    }
                }
                        *value = 0200;  /* tputs will treat this as \0 */
                    }
                }
-               result[used++] = *value++;
+               result[used++] = (char) *value++;
                break;
            case '%':
                result[used++] = *string;
                break;
            case '%':
                result[used++] = *string;
@@ -159,7 +159,8 @@ tgoto_internal(const char *string, int x, int y)
                break;
            }
            if (fmt != 0) {
                break;
            }
            if (fmt != 0) {
-               sprintf(result + used, fmt, *value++);
+               _nc_SPRINTF(result + used, _nc_SLIMIT(length - used)
+                           fmt, *value++);
                used += strlen(result + used);
                fmt = 0;
            }
                used += strlen(result + used);
                fmt = 0;
            }
@@ -174,7 +175,7 @@ tgoto_internal(const char *string, int x, int y)
     }
     if (result != 0) {
        if (need_BC) {
     }
     if (result != 0) {
        if (need_BC) {
-           strcpy(result + used, BC);
+           _nc_STRCPY(result + used, BC, length - used);
            used += strlen(BC);
        }
        result[used] = '\0';
            used += strlen(BC);
        }
        result[used] = '\0';