]> ncurses.scripts.mit.edu Git - ncurses.git/blobdiff - ncurses/tinfo/doalloc.c
ncurses 5.9 - patch 20120225
[ncurses.git] / ncurses / tinfo / doalloc.c
index fe2a009d19b474dbc5b46e28cebcbe9bd18d4ce3..a2aea950e0a64975ced2d692b03e05efa39defa8 100644 (file)
@@ -1,5 +1,5 @@
 /****************************************************************************
 /****************************************************************************
- * Copyright (c) 1998,2000 Free Software Foundation, Inc.                   *
+ * Copyright (c) 1998-2000,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            *
@@ -39,7 +39,7 @@
 
 #include <curses.priv.h>
 
 
 #include <curses.priv.h>
 
-MODULE_ID("$Id: doalloc.c,v 1.8 2002/08/31 21:48:11 Philippe.Blain Exp $")
+MODULE_ID("$Id: doalloc.c,v 1.10 2012/02/22 22:34:31 tom Exp $")
 
 NCURSES_EXPORT(void *)
 _nc_doalloc(void *oldp, size_t amount)
 
 NCURSES_EXPORT(void *)
 _nc_doalloc(void *oldp, size_t amount)
@@ -63,9 +63,10 @@ _nc_strdup(const char *src)
 {
     char *dst;
     if (src != 0) {
 {
     char *dst;
     if (src != 0) {
-       dst = typeMalloc(char, strlen(src) + 1);
+       size_t need = strlen(src) + 1;
+       dst = typeMalloc(char, need);
        if (dst != 0) {
        if (dst != 0) {
-           (void) strcpy(dst, src);
+           _nc_STRCPY(dst, src, need);
        }
     } else {
        dst = 0;
        }
     } else {
        dst = 0;