This is the mail archive of the ecos-patches@sourceware.org mailing list for the eCos 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]

[Bug 1001490] C99 snprintf() does not include terminated null in truncated strings


Please do not reply to this email. Use the web interface provided at:
http://bugs.ecos.sourceware.org/show_bug.cgi?id=1001490

--- Comment #4 from Bernd Edlinger <bernd.edlinger@hotmail.de> 2012-08-08 08:30:42 BST ---
(In reply to comment #3)
oops, sorry... Now I see, actually I applied the my own patch from
http://bugs.ecos.sourceware.org/show_bug.cgi?id=1001628
a while ago, it contained a new test case...

     // Check 7
     ret = snprintf(y, 20, "bit of that: %.4g double", 1.0012);
     my_strcpy(z, "bit of that: 1.001 ");
     CYG_TEST_PASS_FAIL(my_strcmp(y,z) == 0,
                        "snprintf double test #2");

     CYG_TEST_PASS_FAIL(ret == my_strlen(z),
                        "snprintf double test #2 return code");

when that did fail after applying your patch, I was surprised.

Well, there is more trouble with sprintf....

There is another bug #20804, about the %e format, that is also still
not fixed.

When I tried to understand, why that happens, I found a buffer overflow
in the statement: printf("%.15f", DBL_MAX);

There is a buffer in vfnprintf() which is 2 characters too small.
Maybe there should be a patch for all of the known issues.
What do you think?

Bernd.

-- 
Configure bugmail: http://bugs.ecos.sourceware.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


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