Build regex from channel and not sub->channel.#540
Conversation
The sub->channel is a shortened string clipped at ZCM_CHANNEL_MAXLEN=32 while channel is the full string.
|
Hi @jbendes and @olsoni, this is a fix to a bug I encountered when using This change fixes the issue for me. But I do find the whole concept of clipping the string to be a bit sketchy here. It seems like maybe it should be a fatal error if someone calls subscribe with a channel name that is too long? I have an alternative fix where I introduce a |
| sub->regex = isRegexChannel(channel); | ||
| if (sub->regex) { | ||
| sub->regexobj = (void*) new std::regex(sub->channel); | ||
| sub->regexobj = (void*) new std::regex(channel); |
There was a problem hiding this comment.
channel is the complete string. sub->channel has been truncated at ZCM_CHANNEL_MAXLEN. Note that just below here the sub is stored in a map using channel as the key.
The sub->channel is a shortened string clipped at ZCM_CHANNEL_MAXLEN=32 while channel is the full string.