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

Infer issues #219

Open
Xe opened this issue May 18, 2016 · 0 comments
Open

Infer issues #219

Xe opened this issue May 18, 2016 · 0 comments

Comments

@Xe
Copy link
Member

Xe commented May 18, 2016

Starting analysis (Infer version v0.8.1)

Analyzed 205 files

Found 15 issues

/infer/examples/elemental-ircd/libratbox/src/commio.c:1357: error: NULL_DEREFERENCE
  pointer src last assigned on line 1357 could be null and is dereferenced at line 1357, column 17
  1355.       saw_xdigit = 0;
  1356.       val = 0;
  1357. >     while((ch = tolower((unsigned char)*src++)) != '\0') {
  1358.           const char *pch;
  1359.
  1360.

/infer/examples/elemental-ircd/modules/m_time.c:95: error: NULL_DEREFERENCE
  pointer gm last assigned on line 94 could be null and is dereferenced by call to memcpy() at line 95, column 5
  93.       lclock = rb_current_time();
  94.       gm = gmtime(&lclock);
  95. >     memcpy((void *) &gmbuf, (void *) gm, sizeof(gmbuf));
  96.       gm = &gmbuf;
  97.       lt = localtime(&lclock);
  98.

/infer/examples/elemental-ircd/modules/m_time.c:99: error: NULL_DEREFERENCE
  pointer lt last assigned on line 97 could be null and is dereferenced at line 99, column 8
  97.       lt = localtime(&lclock);
  98.
  99. >     if(lt->tm_yday == gm->tm_yday)
  100.           minswest = (gm->tm_hour - lt->tm_hour) * 60 + (gm->tm_min - lt->tm_min);
  101.       else if(lt->tm_yday > gm->tm_yday && lt->tm_year == gm->tm_year)
  102.

/infer/examples/elemental-ircd/src/client.c:828: error: NULL_DEREFERENCE
  pointer oper last assigned on line 827 could be null and is dereferenced at line 828, column 45
  826.           return FALSE;
  827.       oper = find_named_person(client_p->serv->by);
  828. >     return oper != NULL && IsOper(oper) && !MyConnect(oper);
  829.   }
  830.
  831.

/infer/examples/elemental-ircd/src/ircd.c:162: error: RESOURCE_LEAK
   resource acquired by call to open() at line 162, column 9 is not released after line 162, column 9
  160.           fclose(stdout);
  161.           fclose(stderr);
  162. >         open("/dev/null", O_RDWR);
  163.           dup2(0, 1);
  164.           dup2(0, 2);
  165.

/infer/examples/elemental-ircd/src/ircd.c:490: error: RESOURCE_LEAK
   resource acquired to fd by call to open() at line 482, column 10 is not released after line 490, column 5
  488.           }
  489.       }
  490. >     return 0;
  491.   }
  492.
  493.

/infer/examples/elemental-ircd/src/listener.c:392: error: MEMORY_LEAK
   listener_next is not reachable after line 392, column 49
  390.        * close all 'extra' listening ports we have
  391.        */
  392. >     for (listener = ListenerPollList; listener; listener = listener_next) {
  393.           listener_next = listener->next;
  394.           close_listener(listener);
  395.

/infer/examples/elemental-ircd/src/logger.c:265: error: NULL_DEREFERENCE
  pointer lt last assigned on line 262 could be null and is dereferenced at line 265, column 17
  263.
  264.       snprintf(buf, sizeof(buf), "%d/%d/%d %02d.%02d",
  265. >                 lt->tm_year + 1900, lt->tm_mon + 1,
  266.                   lt->tm_mday, lt->tm_hour, lt->tm_min);
  267.
  268.

/infer/examples/elemental-ircd/tools/mkpasswd.c:475: error: RESOURCE_LEAK
   resource acquired by call to open() at line 468, column 11 is not released after line 475, column 8
  473.          if(read(fd, buf, length) != length)
  474.          {
  475. >                free(buf);
  476.                  return (generate_poor_salt(salt, length));
  477.          }
  478.

/infer/examples/elemental-ircd/tools/mkpasswd.c:479: error: RESOURCE_LEAK
   resource acquired to i by call to open() at line 468, column 11 is not released after line 479, column 6
  477.          }
  478.
  479. >        for(i = 0; i < length; i++)
  480.          {
  481.                  salt[i] = saltChars[abs(buf[i]) % 64];
  482.

Summary of the reports

I selectively omitted a bunch of issues with the configuration parser, it's generated code and the output might not be entirely accurate.

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

1 participant