Merge PR #5289: fix string size check and assert condition

Merge PR #5289