mirror of
https://github.com/jmcnamara/libxlsxwriter.git
synced 2026-05-15 14:15:54 -06:00
utility: use size_t index and unsigned char cast in lxw_str_tolower
The loop counter was signed int, which is the wrong type for indexing into a string. Change it to size_t. Also add the required (unsigned char) cast on the tolower argument. Passing a plain char to tolower is undefined behaviour when char is signed and the value is negative (any byte with the high bit set). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
de6aaee236
commit
da95035568
1 changed files with 2 additions and 2 deletions
|
|
@ -589,10 +589,10 @@ lxw_utf8_strlen(const char *str)
|
|||
void
|
||||
lxw_str_tolower(char *str)
|
||||
{
|
||||
int i;
|
||||
size_t i;
|
||||
|
||||
for (i = 0; str[i]; i++)
|
||||
str[i] = tolower(str[i]);
|
||||
str[i] = tolower((unsigned char) str[i]);
|
||||
}
|
||||
|
||||
/* Simple check for empty strings. */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue