[En-Nut-Discussion] Issue with thread name in AVR arch
Ole Reinhardt
ole.reinhardt at embedded-it.de
Tue Jan 26 14:01:35 CET 2010
Hi!
I've reviewed your patch at sourceforge.net.
I don't see a chance of getting garbage characters at the end of the
name string:
memcpy(td->td_name, name, sizeof(td->td_name) - 1);
td->td_name[sizeof(td->td_name) - 1] = 0;
In case name is shorter than sizeof(td->td_name) the full name string
including terminating '0' byte will be copied.
In case name is longer than sizeof(td->td_name) the string will be
copied partly and a terminating 0 will be added. So your name will be
truncated.
Garbage is only possible if your Name string is not zero terminated and
shorter than sizeof(td->td_name);
If you call NutThreadCreate this won't be possible? Have I missed
something?
Regards,
Ole Reinhardt
--
Thermotemp GmbH, Embedded-IT
Embedded Hard-/ Software and Open Source Development,
Integration and Consulting
Geschäftsstelle Siegen - Steinstraße 67 - D-57072 Siegen -
tel +49 (0)271 5513597, +49 (0)271-73681 - fax +49 (0)271 736 97
Hauptsitz - Hademarscher Weg 7 - 13503 Berlin
Tel +49 (0)30 4315205 - Fax +49 (0)30 43665002
Geschäftsführer: Jörg Friedrichs, Ole Reinhardt
Handelsregister Berlin Charlottenburg HRB 45978 UstID DE 156329280
More information about the En-Nut-Discussion
mailing list