| Bug #10060 | mysql_real_escape returns -1 when escaping a single backslash | ||
|---|---|---|---|
| Submitted: | 21 Apr 2005 13:59 | Modified: | 27 Apr 2005 9:49 |
| Reporter: | Georg Richter | Email Updates: | |
| Status: | Duplicate | Impact on me: | |
| Category: | MySQL Server | Severity: | S1 (Critical) |
| Version: | 5.0.5 | OS: | Linux (Linux) |
| Assigned to: | Assigned Account | CPU Architecture: | Any |
[21 Apr 2005 14:35]
Jorge del Conde
Verified w/5.0.5 from bk: jorge-jorge/mysql_code> ./main to has length: -1
[27 Apr 2005 9:49]
Alexander Barkov
Duplicate with this bug: #9756: mysql client failing on dumps containing certain \ sequences fixed by Ramil on April 26, 2005.

Description: When attempting to escape a single backslash mysql_real_escape returns -1. (compiled with charset latin1). How to repeat: #include <stdio.h> #include <mysql.h> int main(void) { MYSQL *mysql; char *from = "\\"; char to[1024]; ulong rc; mysql= mysql_init(NULL); mysql_real_connect(mysql,"localhost","root",NULL,"test",0,NULL,0); rc = mysql_real_escape_string(mysql, (char *)&to, from, strlen(from)); printf("to has length: %d\n", rc); mysql_close(mysql); }