X-Git-Url: https://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=ncurses%2Ftinfo%2Fstrings.c;h=10ec6c8d8ac9f98a27b47823177c1fd4a543d17f;hp=78cd2ef4f5f510ca7a4bdc36349b9f9d62f81626;hb=fe43d506ce08d1deef9e9e5a6d5fd4f9c9c32e1d;hpb=cd858895e9086dadfb3d0a9ae69bc906de6330ea diff --git a/ncurses/tinfo/strings.c b/ncurses/tinfo/strings.c index 78cd2ef4..10ec6c8d 100644 --- a/ncurses/tinfo/strings.c +++ b/ncurses/tinfo/strings.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 2000-2003,2007 Free Software Foundation, Inc. * + * Copyright (c) 2000-2012,2017 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 * @@ -35,8 +35,9 @@ **/ #include +#include -MODULE_ID("$Id: strings.c,v 1.6 2007/08/11 17:12:17 tom Exp $") +MODULE_ID("$Id: strings.c,v 1.9 2017/08/26 13:16:11 tom Exp $") /**************************************************************************** * Useful string functions (especially for mvcur) @@ -105,12 +106,12 @@ _nc_str_copy(string_desc * dst, string_desc * src) NCURSES_EXPORT(bool) _nc_safe_strcat(string_desc * dst, const char *src) { - if (src != 0) { + if (PRESENT(src)) { size_t len = strlen(src); if (len < dst->s_size) { if (dst->s_tail != 0) { - strcpy(dst->s_tail, src); + _nc_STRCPY(dst->s_tail, src, dst->s_size); dst->s_tail += len; } dst->s_size -= len; @@ -126,12 +127,12 @@ _nc_safe_strcat(string_desc * dst, const char *src) NCURSES_EXPORT(bool) _nc_safe_strcpy(string_desc * dst, const char *src) { - if (src != 0) { + if (PRESENT(src)) { size_t len = strlen(src); if (len < dst->s_size) { if (dst->s_head != 0) { - strcpy(dst->s_head, src); + _nc_STRCPY(dst->s_head, src, dst->s_size); dst->s_tail = dst->s_head + len; } dst->s_size = dst->s_init - len;