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] |
Date: Fri, 26 Mar 2010 10:51:02 -0700 From: Stan Shebs <stan@codesourcery.com> CC: Stan Shebs <stan@codesourcery.com>, gdb-patches@sourceware.org
Eli Zaretskii wrote:
Presumably even a hypothetical future 128-bit address won't need more than 65 chars to print. :-)struct breakpoint *Tz-tz-tz... Using a constant-size buffer in sprintf without any check
create_tracepoint_from_upload (struct uploaded_tp *utp)
{
! char *addr_str, small_buf[100];
[...]
! sprintf (small_buf, "*%s", hex_string (utp->addr));
for overflow? Are you sure that calling the buffer ``small'' will
magically keep you from trouble? ;-)
Yes, and then someone comes up and changes the code to put there something in addition to the address (you already prepend an asterisk to it).
But if I'm the only one who is bothered by this, I withdraw my
objections.
I was hoping to fix a major brain cramp of mine without anybody noticing - oh well. :-) The two numeric arguments to fwrite are semi-redundant a la calloc, and the return result is based on the *second* argument, which is the number of "items".written = fwrite ("\x7fTRACE0\n", 8, 1, fp);Why did you change this to accept partial writes?
! if (written < 8)
perror_with_name (pathname);
/* Write descriptive info. */
--- 2468,2474 ----
binary file, plus a hint as what this file is, and a version
number in case of future needs. */
written = fwrite ("\x7fTRACE0\n", 8, 1, fp);
! if (written < 1)
perror_with_name (pathname);
So you are writing a string as if it were an 8-byte int? Won't that
swap bytes on some architectures? And why pretend that a string is a
number, anyway?
As for the rest, my questions were meant to signal that portions of the description are not clear enough, and could use some more explicit description and/or references to other parts of the manual.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |