[CONC-46] Issue with setlocale Created: 2013-08-14  Updated: 2013-08-14  Resolved: 2013-08-14

Status: Closed
Project: MariaDB Connector/C
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Critical
Reporter: Vishal PR Assignee: Georg Richter
Resolution: Fixed Votes: 0
Labels: None
Environment:

OS: Windows 8 Professional 64-bit
Locale: Japanese_Japan.932
Faulting C run-time library function: _vsnprintf



 Description   

In source file my_init.c, there is a call

setlocale(LC_CTYPE, ""); /* To get right sortorder */

This will eventually set the locale to system locale. C run-time functions uses this information for validating/comparing parameters. In my understanding this is dangerous thing to do for a UTF-8 client. As UTF-8 doesnt depend on any locale, the passed string might have some character sequence that the string functions consider improper. This is resulting in exception.

I checked the mariadbclient source and couldn't find any relevent functions which uses strcmp and depends on locale. So I think it is not doing anything the comment says, correct me if I am wrong.

On a side note I believe MariaDB client shouldn't have set the locale on the whole, it should have rather used the locale enabled versions of string functions for its internal use.



 Comments   
Comment by Georg Richter [ 2013-08-14 ]

Fixed in rev. 79

Generated at Thu Feb 08 03:02:29 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.