Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixes from PVS-Studio #2032

wants to merge 1 commit into from


None yet
2 participants
Copy link

commented Oct 30, 2017

I'm a member of the competition on finding errors in open source projects. A bug, found using PVS-Studio. Warnings:

V522 Dereferencing of the null pointer 'pv' might take place. cookie.c 316

fixes from PVS-Studio
V522 Dereferencing of the null pointer 'pv' might take place. cookie.c 316

This comment has been minimized.

Copy link

commented Oct 30, 2017

CI failures because it doesn't follow our code style. But more importantly, shouldn't the fix rather be?

--- a/lib/cookie.c
+++ b/lib/cookie.c
@@ -307,11 +307,11 @@ static void remove_expired(struct CookieInfo *cookies)
   co = cookies->cookies;
   pv = NULL;
   while(co) {
     nx = co->next;
     if(co->expires && co->expires < now) {
-      if(co == cookies->cookies) {
+      if(!pv) {
         cookies->cookies = co->next;
       else {
         pv->next = co->next;

bagder added a commit that referenced this pull request Oct 30, 2017

cookie: avoid NULL dereference
... when expiring old cookies.

Reported-by: Pavel Gushchin
Fixes #2032

@bagder bagder closed this in fa394c8 Oct 31, 2017

@lock lock bot locked as resolved and limited conversation to collaborators Jan 18, 2019

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.