X-Git-Url: http://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=ncurses%2Ftinfo%2Fstrings.c;h=a1d8beb63f31e6db47f6e6c6b58df25588b93acc;hp=78cd2ef4f5f510ca7a4bdc36349b9f9d62f81626;hb=56a81c7e79f73d397cc8074401d039f59c34cad5;hpb=cd858895e9086dadfb3d0a9ae69bc906de6330ea diff --git a/ncurses/tinfo/strings.c b/ncurses/tinfo/strings.c index 78cd2ef4..a1d8beb6 100644 --- a/ncurses/tinfo/strings.c +++ b/ncurses/tinfo/strings.c @@ -1,5 +1,6 @@ /**************************************************************************** - * Copyright (c) 2000-2003,2007 Free Software Foundation, Inc. * + * Copyright 2020 Thomas E. Dickey * + * Copyright 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 +36,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.10 2020/02/02 23:34:34 tom Exp $") /**************************************************************************** * Useful string functions (especially for mvcur) @@ -105,12 +107,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 +128,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;