Commit cd8d2039 authored by Alan Modra's avatar Alan Modra
Browse files

[GOLD] gcc-11 stringop-overflow warning

I'm unsure why this is deserving of a warning.  Not writing the most
efficient code surely can't be a real problem, but that is what seems to say. error: 'char* strncpy(char*, const char*, size_t)' specified bound depends on the length of the source argument [-Werror=stringop-overflow=]
  528 |   strncpy(tempdir, dir_template, len);
      |   ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~ note: length computed here
  526 |   size_t len = strlen(dir_template) + 1;
      |                ~~~~~~^~~~~~~~~~~~~~

	* (Plugin_recorder::init): Replace strncpy with memcpy.
parent fde0214a
2020-12-07 Alan Modra <>
* (Plugin_recorder::init): Replace strncpy with memcpy.
2020-12-03 Alan Modra <>
* testsuite/ (pr26936a.o): Pass -mx86-used-note=yes.
......@@ -525,7 +525,7 @@ Plugin_recorder::init()
size_t len = strlen(dir_template) + 1;
char* tempdir = new char[len];
strncpy(tempdir, dir_template, len);
memcpy(tempdir, dir_template, len);
// Create the log file.
std::string logname(tempdir);
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment