This is the mail archive of the binutils@sourceware.org mailing list for the binutils 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: [PATCH] libiberty: Fix and cleanup choose_temp_base()


On Thu, Nov 7, 2019 at 9:09 AM Tim Rühsen <tim.ruehsen@gmx.de> wrote:
>
> reduced code size by using xasprintf().
>
> Please review the check of mktemp(), which was formerly checking against
> 0 (regarding glibc man pages that was wrong). I left that check intact
> (just in case I miss something) and added the check for an empty string,
> as documented in the glibc man pages.
>
> Does it make sense to further replace strlen/malloc/strcpy/strcat
> sequences by [x]asprintf in order to reduce source lines and library
> (binary) size ? (In the means of "is it appreciated")
>
> A side effect is calming down static analyzers that dislike unbounded
> memory accesses and thus warn about strcpy() and strcat().

The new code is simpler but it will run slower.  The existing code has
been there for 20 years, I doubt it's buggy.  I don't see a benefit to
making this change.

Ian


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