/****************************************************************************
- * Copyright (c) 1998-2008,2010 Free Software Foundation, Inc. *
+ * Copyright 2020 Thomas E. Dickey *
+ * Copyright 1998-2011,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 *
#include <curses.priv.h>
-MODULE_ID("$Id: trace_buf.c,v 1.16 2011/01/09 00:08:31 tom Exp $")
+MODULE_ID("$Id: trace_buf.c,v 1.21 2020/02/02 23:34:34 tom Exp $")
#ifdef TRACE
NCURSES_EXPORT(char *)
_nc_trace_bufcat(int bufnum, const char *value)
{
- char *buffer = _nc_trace_alloc(bufnum, 0);
+ char *buffer = _nc_trace_alloc(bufnum, (size_t) 0);
if (buffer != 0) {
size_t have = strlen(buffer);
+ size_t need = strlen(value) + have;
- buffer = _nc_trace_alloc(bufnum, 1 + have + strlen(value));
+ buffer = _nc_trace_alloc(bufnum, 1 + need);
if (buffer != 0)
- (void) strcpy(buffer + have, value);
+ _nc_STRCPY(buffer + have, value, need);
}
return buffer;