This is the mail archive of the gdb-patches@sources.redhat.com 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: PATCH: Add type_sprint() function to return type in string form



GDB should use neither sprint* nor asprint*.


I disagree.  Why on earth wouldn't we use sprintf?  Just because it can
be used incorrectly is no excuse.

You're kidding right?


The ARI indicates that all sprintf calls should be replaced with either snprintf or xasprintf.

Replacing sprintf with functions that are immune to buffer overrun problems, eliminates an entire class of bug.

Even something as simple as:
	char buf[100000000];
	sprintf (buf, _("a"));
is broken.

The xasprint* family all have the signature:

...xasprint* (char **buf, ....)

which doesn't apply here.


Perhaps it should apply?

Sure, but the interface would sux.


Andrew



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