X-Git-Url: http://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=ncurses%2Ftinfo%2Fdoalloc.c;h=a2aea950e0a64975ced2d692b03e05efa39defa8;hp=fe2a009d19b474dbc5b46e28cebcbe9bd18d4ce3;hb=8b06e371ed1bce3dd6f37138e6becb5e1a562fe0;hpb=a3173aa5edbdbc6d617800f81a88a304ac5e053c diff --git a/ncurses/tinfo/doalloc.c b/ncurses/tinfo/doalloc.c index fe2a009d..a2aea950 100644 --- a/ncurses/tinfo/doalloc.c +++ b/ncurses/tinfo/doalloc.c @@ -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 * @@ -39,7 +39,7 @@ #include -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) @@ -63,9 +63,10 @@ _nc_strdup(const char *src) { char *dst; if (src != 0) { - dst = typeMalloc(char, strlen(src) + 1); + size_t need = strlen(src) + 1; + dst = typeMalloc(char, need); if (dst != 0) { - (void) strcpy(dst, src); + _nc_STRCPY(dst, src, need); } } else { dst = 0;