These are false positives and gcc internal detection of this pattern seems to be broken again. In this path we must avoid memcpy the whole buffer, it can contain some bytes after null char, so use MIN/strlen here.