rmqcpp icon indicating copy to clipboard operation
rmqcpp copied to clipboard

Routing key length is not validated

Open Pasick opened this issue 1 year ago • 0 comments

The topic exchange routing key has a limitation of 255 bytes (see https://www.rabbitmq.com/tutorials/tutorial-five-go#:~:text=There%20can%20be%20as%20many,be%20in%20the%20same%20form.). However, this limitation is not applied when binding queue to an exchange or sending the message:

To Reproduce

  1. Specify a long routing key (>255 characters) when binging a queue to an exchange: topology.bind(exchange, queue, longRoutingKey); No errors will be reported but the process will hang forever.
  2. Specify a long routing key (>255 characters) when sending the message: producer->send(message, longRoutingKey, ...); The following error will be reported: 13JAN2025_08:46:10.559653 350290 140737331340864 WARN /home/pasick/github/pasick-clean/rmqcpp/src/rmq/rmqio/rmqio_asioconnection.cpp 410 UNINITIALIZED_LOGGER_MANAGER Socket closed: Connection reset by peer. Current state: 1 and the connection will be closed.

Please refer to the attached sample which demonstrates the issue: longRoutingKeyIssue.txt

Expected behavior I believe that the size of the routing key should be validated and do not accept values larger that 255 bytes.

Pasick avatar Jan 13 '25 12:01 Pasick