We want to restrict the maximum topic length. Right now, the topic length field is a uint64_t, allowing a really huge string with its potential security risks. We can change uint64_t to a uint16_t. On the one hand, uint16_t is not very big and it forbids to have very long topic. On other hand, uint16_t is not very small and it allows to have enough space for any potential topic value.
Changing uint64_t to a uint16_t.
Adding tests for Publisher::MsgLength() method.
Adding TopicUtils::kMaxNameLength = 65535. The kMaxNameLength specifies the maximum number of characters allowed in a namespace, a partition name, a topic name, and a fully qualified topic name.
How about the code to guarantee that a topic always fit in a size16_t variable? I'm thinking on a check in TopicUtils::FullyQualifiedName() with its own test. The max size should be now 65535. The result of FullyQualifiedName() is the topic that we use to create a Publisher object.