Skip to content
This repository has been archived by the owner on Feb 11, 2020. It is now read-only.

':' in a client id raises exception #439

Closed
cfchou opened this issue Apr 1, 2016 · 2 comments
Closed

':' in a client id raises exception #439

cfchou opened this issue Apr 1, 2016 · 2 comments

Comments

@cfchou
Copy link
Contributor

cfchou commented Apr 1, 2016

Hi,

We found that Mosca crashes when an offline message is being delivered to a client with the id containing ':'.

Steps to reproduce the problem:

  1. mosquitto_sub -h 127.0.0.1 -p 1883 -d -v -t 'test' -i '14:e6:76:46:93:31' -k 600 -q 1 -c
  2. ctrl-c
  3. mosquitto_pub -h 127.0.0.1 -p 1883 -q 1 -t 'test' -m 'hello'
  4. mosquitto_sub -h 127.0.0.1 -p 1883 -d -v -t 'test' -i '14:e6:76:46:93:31' -k 600 -q 1 -c

The problem seems to be that in
lib/persistence/redis.js
keyRegexp /^([^:]+):([^:]+):([^:]+)$/ fails to match and throws exception.

We propose to change keyRegexp to /^([^:]+):([^:]+):(.+)/.
Is there any concern regarding to this proposal?

Thank you.

@mcollina
Copy link
Collaborator

mcollina commented Apr 1, 2016

Yes. Please send a PR with a unit test.
Il giorno ven 1 apr 2016 alle 07:39 cfchou [email protected] ha
scritto:

Hi,

We found that Mosca crashes when an offline message is being delivered to
a client with the id containing ':'.

Steps to reproduce the problem:

  1. mosquitto_sub -h 127.0.0.1 -p 1883 -d -v -t 'test' -i
    '14:e6:76:46:93:31' -k 600 -q 1 -c
  2. ctrl-c
  3. mosquitto_pub -h 127.0.0.1 -p 1883 -q 1 -t 'test' -m 'hello'
  4. mosquitto_sub -h 127.0.0.1 -p 1883 -d -v -t 'test' -i
    '14:e6:76:46:93:31' -k 600 -q 1 -c

The problem seems to be that in
lib/persistence/redis.js
https://github.com/mcollina/mosca/blob/master/lib/persistence/redis.js#L376
keyRegexp /^([^:]+):([^:]+):([^:]+)$/ fails to match and throws exception.

We propose to change keyRegexp to /^([^:]+):([^:]+):(.+)/.
Is there any concern regarding to this proposal?

Thank you.


You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub
#439

@mcollina
Copy link
Collaborator

mcollina commented Apr 7, 2016

Fixed in v1.1.3.

@mcollina mcollina closed this as completed Apr 7, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants