forked from Imagelibrary/binutils-gdb
gprof: sprintf sanitizer null destination pointer
* basic_blocks.c (annotate_with_count): Use output of sprintf rather than strlen.
This commit is contained in:
@@ -360,8 +360,7 @@ annotate_with_count (char *buf, unsigned int width, int line_num, void *arg)
|
|||||||
execution count (if bb_annotate_all_lines is set). */
|
execution count (if bb_annotate_all_lines is set). */
|
||||||
if (b->is_func)
|
if (b->is_func)
|
||||||
{
|
{
|
||||||
sprintf (p, "%lu", b->ncalls);
|
p += sprintf (p, "%lu", b->ncalls);
|
||||||
p += strlen (p);
|
|
||||||
last_count = b->ncalls;
|
last_count = b->ncalls;
|
||||||
last_print = last_count;
|
last_print = last_count;
|
||||||
ncalls = b->ncalls;
|
ncalls = b->ncalls;
|
||||||
@@ -370,8 +369,7 @@ annotate_with_count (char *buf, unsigned int width, int line_num, void *arg)
|
|||||||
else if (bb_annotate_all_lines
|
else if (bb_annotate_all_lines
|
||||||
&& b->bb_addr[0] && b->bb_addr[0] > b->addr)
|
&& b->bb_addr[0] && b->bb_addr[0] > b->addr)
|
||||||
{
|
{
|
||||||
sprintf (p, "%lu", last_count);
|
p += sprintf (p, "%lu", last_count);
|
||||||
p += strlen (p);
|
|
||||||
last_print = last_count;
|
last_print = last_count;
|
||||||
ncalls = last_count;
|
ncalls = last_count;
|
||||||
ncalls_set = 1;
|
ncalls_set = 1;
|
||||||
@@ -396,8 +394,7 @@ annotate_with_count (char *buf, unsigned int width, int line_num, void *arg)
|
|||||||
|
|
||||||
if (p > tmpbuf)
|
if (p > tmpbuf)
|
||||||
*p++ = ',';
|
*p++ = ',';
|
||||||
sprintf (p, "%lu", last_count);
|
p += sprintf (p, "%lu", last_count);
|
||||||
p += strlen (p);
|
|
||||||
|
|
||||||
last_print = last_count;
|
last_print = last_count;
|
||||||
}
|
}
|
||||||
@@ -410,8 +407,7 @@ annotate_with_count (char *buf, unsigned int width, int line_num, void *arg)
|
|||||||
|
|
||||||
if (bb_annotate_all_lines && p == tmpbuf)
|
if (bb_annotate_all_lines && p == tmpbuf)
|
||||||
{
|
{
|
||||||
sprintf (p, "%lu", last_count);
|
p += sprintf (p, "%lu", last_count);
|
||||||
p += strlen (p);
|
|
||||||
ncalls = last_count;
|
ncalls = last_count;
|
||||||
ncalls_set = 1;
|
ncalls_set = 1;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user