Ticket #2881 (closed defect: fixed)

Opened 19 months ago

Last modified 10 months ago

getCookie retrieves wrong value when name is a substring of multiple cookies

Reported by: guest Owned by: peller
Priority: normal Milestone: 1.1
Component: General Version: 0.4.2
Severity: normal Keywords:
Cc: pat@…

Description

If you set two cookies "mycook" and "XXXmycook", then (depending on the order the cookies are set) getCookie('mycook') will return the value for "XXXmycook".

getCookie uses the following code which can match "mycook" and "XXXmycook": var idx = document.cookie.lastIndexOf(name+'=');

Attachments

test-cookie.html (0.7 kB) - added by guest 19 months ago.
Test case for getCookie bug
test-cookie-replacement.html (1.0 kB) - added by guest 19 months ago.
Possible fix for getCookie using regexp

Change History

Changed 19 months ago by guest

Test case for getCookie bug

Changed 19 months ago by guest

Possible fix for getCookie using regexp

Changed 19 months ago by guest

Can someone add a CC: pat@…

I submitted the ticket but it didn't list me as submitter and I'd like to get updates when this is fixed.

Changed 19 months ago by jburke

  • cc pat@… added

Changed 10 months ago by peller

  • owner changed from anonymous to blowery
  • milestone set to 1.1

looks like this code is still in 1.0+

Changed 10 months ago by peller

  • status changed from new to assigned
  • owner changed from blowery to peller

Changed 10 months ago by peller

  • status changed from assigned to closed
  • resolution set to fixed

(In [12333]) Use regexp to find cookie contents. (thanks, Pat) Fixes #2881. Correct docs on deleting cookies. Fixes #5782 !strict

Changed 10 months ago by peller

(In [12334]) Missed reference in reduction. Refs #2881. !strict

Note: See TracTickets for help on using tickets.