drogonframework / drogonframework/drogon
Wrong string size in models
- Dominant language
- C++
- Stars
- 14.3k
- Forks
- 1.4k
- Avg merge
- 1d 13h
- Merged PRs (30d)
- 14
Description
I have postgreSQL table with string type column. String has 127 symbols limit, so created by drogon_ctl model.cc has check
``` cpp
if(pJson.isString() && std::strlen(pJson.asCString()) > 127)
{
err="String length exceeds limit for the " +
fieldName +
" field (the maximum value is 127)";
return false;
}
```
However, `std::strlen` counts non English letters twice, so this check in `validateJsonForCreation` fails on valid string with more then 63 non English letters.
Maybe this check should use `size()` method of `std::string`?
Contributor guide
Assessment
This issue has not been assessed yet.