2017-04-13 Martin Liska <mliska@suse.cz>
PR gcov-profile/80413
* gcov-io.c (gcov_write_string): Copy to buffer just when
allocated size is greater than zero.
From-SVN: r246903
+2017-04-13 Martin Liska <mliska@suse.cz>
+
+ PR gcov-profile/80413
+ * gcov-io.c (gcov_write_string): Copy to buffer just when
+ allocated size is greater than zero.
+
2017-04-13 Jakub Jelinek <jakub@redhat.com>
PR debug/80321
buffer = gcov_write_words (1 + alloc);
buffer[0] = alloc;
- buffer[alloc] = 0;
- memcpy (&buffer[1], string, length);
+
+ if (alloc > 0)
+ {
+ buffer[alloc] = 0; /* place nul terminators. */
+ memcpy (&buffer[1], string, length);
+ }
}
#endif