fix: failed to identify dbName when only ? exists

This commit is contained in:
xjzhou 2024-06-26 16:38:21 +08:00
parent 1a32279f7f
commit 42361fcd45
1 changed files with 6 additions and 6 deletions

View File

@ -75,11 +75,11 @@ bool qParseDbName(const char* pStr, size_t length, char** pDbName) {
*pDbName = NULL; *pDbName = NULL;
return false; return false;
} }
char *dotPos = strchr(t.z, '.'); char *dotPos = strnchr(t.z, '.', t.n, true);
if (dotPos != NULL) { if (dotPos != NULL) {
int dbNameLen = dotPos - t.z; int dbNameLen = dotPos - t.z;
*pDbName = taosMemoryMalloc(dbNameLen + 1); *pDbName = taosMemoryMalloc(dbNameLen + 1);
if (NULL == *pDbName) { if (*pDbName == NULL) {
return false; return false;
} }
strncpy(*pDbName, t.z, dbNameLen); strncpy(*pDbName, t.z, dbNameLen);