This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: New ARI warning Sat May 28 01:53:47 UTC 2011


> This is by me:
>   char buffer[MAXPATHLEN];
>   sprintf (buffer, "/proc/%ld/status", lwp);
> 
> I find the code perfectly correct, as I was told the ARI checks are only
> differential I hope it can be kept as is.

I reached a similar conclusion when I looked at it this morning.
We could make the code marginally better in the sense that we'd
remove the static buffer, but at the cost of making the code
a little more convoluted (once we malloc, we need to make sure
we always free, which probably means a cleanup, etc). So I also
vote for leaving the code as is.

That lead me to consider the removal of this rule.  But in the end,
I think it's useful to be reminded every time we use sprintf that
there is xtrsprintf. Since this hasn't produced too many false
positives, I think it's OK to keep it for now.

In the meantime, I think there is a way to say that this line is OK.
If you put /* ARI: sprintf */ on the sprintf line, that should take
care of the warning...

-- 
Joel


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]