![]() Character array arguments, where end of actual character string is marked by a character with value zero, may be combined with a argument containing the maximum length allowed. The "const" specifier in the definition of a function, does not nessesarily mean that the argument array is located in flash memory, what it mean, is that contents of the argument array will not be changed inside the function. In example code in message #1, character strings terminated by zero may function, but in a general case, where messages are put together, piece by piece in a RAM array, a code mistake, may cause bugs that may be difficult to isolate. Passing string addresses without corresponding length arguments, is one of the ways to do that. In C, it is allowed to "shoot yourself in the foot". In some other programming languages, they put in a lot of hidden code to pass string length along, without application code having to take care of it. It have caused many problems with run-away code, overwrites, or attacks from wrong or malicious code. ![]() ![]() ![]() ![]() Hi, Passing strings without actual string size, or maximum string size, is a design mistake in many C library functions. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |