Flawfinder version 2.0.10, (C) 2001-2019 David A. Wheeler. Number of rules (primarily dangerous function names) in C/C++ ruleset: 223 Examining data/xfce4-mailwatch-plugin-1.3.0/panel-plugin/mailwatch-plugin.c Examining data/xfce4-mailwatch-plugin-1.3.0/libmailwatch-core/mailwatch-mailbox-maildir.c Examining data/xfce4-mailwatch-plugin-1.3.0/libmailwatch-core/mailwatch-net-conn.c Examining data/xfce4-mailwatch-plugin-1.3.0/libmailwatch-core/mailwatch-common.h Examining data/xfce4-mailwatch-plugin-1.3.0/libmailwatch-core/mailwatch-mailbox-gmail.c Examining data/xfce4-mailwatch-plugin-1.3.0/libmailwatch-core/mailwatch-mailbox.h Examining data/xfce4-mailwatch-plugin-1.3.0/libmailwatch-core/mailwatch-utils.h Examining data/xfce4-mailwatch-plugin-1.3.0/libmailwatch-core/mailwatch-mailbox-mh.c Examining data/xfce4-mailwatch-plugin-1.3.0/libmailwatch-core/mailwatch-mailbox-pop3.c Examining data/xfce4-mailwatch-plugin-1.3.0/libmailwatch-core/mailwatch.h Examining data/xfce4-mailwatch-plugin-1.3.0/libmailwatch-core/mailwatch-mailbox-mbox.c Examining data/xfce4-mailwatch-plugin-1.3.0/libmailwatch-core/mailwatch-net-conn.h Examining data/xfce4-mailwatch-plugin-1.3.0/libmailwatch-core/mailwatch-utils.c Examining data/xfce4-mailwatch-plugin-1.3.0/libmailwatch-core/mailwatch-mailbox-imap.c Examining data/xfce4-mailwatch-plugin-1.3.0/libmailwatch-core/mailwatch-common.c Examining data/xfce4-mailwatch-plugin-1.3.0/libmailwatch-core/mailwatch.c FINAL RESULTS: data/xfce4-mailwatch-plugin-1.3.0/libmailwatch-core/mailwatch.c:392:8: [5] (race) chmod: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchmod( ) instead. if(chmod(config_file, 0600)) { data/xfce4-mailwatch-plugin-1.3.0/libmailwatch-core/mailwatch-mailbox-mh.c:303:40: [3] (buffer) g_get_home_dir: This function is synonymous with 'getenv("HOME")';it returns untrustable input if the environment can beset by an attacker. It can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. mh_profile = g_build_filename( g_get_home_dir(), MH_PROFILE, NULL ); data/xfce4-mailwatch-plugin-1.3.0/libmailwatch-core/mailwatch-mailbox-mh.c:347:36: [3] (buffer) g_get_home_dir: This function is synonymous with 'getenv("HOME")';it returns untrustable input if the environment can beset by an attacker. It can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. tmpptr = g_build_filename( g_get_home_dir(), mh_path, NULL ); data/xfce4-mailwatch-plugin-1.3.0/libmailwatch-core/mailwatch-mailbox-gmail.c:249:32: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). respcode = atoi(p+1); data/xfce4-mailwatch-plugin-1.3.0/libmailwatch-core/mailwatch-mailbox-gmail.c:295:13: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(buf+strlen(p), buf1, strlen(buf1)); data/xfce4-mailwatch-plugin-1.3.0/libmailwatch-core/mailwatch-mailbox-gmail.c:310:15: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). tmp = atoi(p); data/xfce4-mailwatch-plugin-1.3.0/libmailwatch-core/mailwatch-mailbox-gmail.c:615:33: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). gmailbox->timeout = atoi(param->value); data/xfce4-mailwatch-plugin-1.3.0/libmailwatch-core/mailwatch-mailbox-imap.c:573:28: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). new_messages = atoi(p+8); data/xfce4-mailwatch-plugin-1.3.0/libmailwatch-core/mailwatch-mailbox-imap.c:1538:34: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). imailbox->nonstandard_port = atoi(gtk_editable_get_chars(GTK_EDITABLE(w), 0, -1)); data/xfce4-mailwatch-plugin-1.3.0/libmailwatch-core/mailwatch-mailbox-imap.c:1833:35: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). imailbox->auth_type = atoi(param->value); data/xfce4-mailwatch-plugin-1.3.0/libmailwatch-core/mailwatch-mailbox-imap.c:1839:42: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). imailbox->nonstandard_port = atoi(param->value); data/xfce4-mailwatch-plugin-1.3.0/libmailwatch-core/mailwatch-mailbox-imap.c:1841:33: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). imailbox->timeout = atoi(param->value); data/xfce4-mailwatch-plugin-1.3.0/libmailwatch-core/mailwatch-mailbox-imap.c:1843:31: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). n_newmail_boxes = atoi(param->value); data/xfce4-mailwatch-plugin-1.3.0/libmailwatch-core/mailwatch-mailbox-imap.c:1855:34: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). gint box_index = atoi(param->key + 12); data/xfce4-mailwatch-plugin-1.3.0/libmailwatch-core/mailwatch-mailbox-maildir.c:259:30: [2] (integer) atol: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). maildir->mtime = atol( param->value ); data/xfce4-mailwatch-plugin-1.3.0/libmailwatch-core/mailwatch-mailbox-maildir.c:262:41: [2] (integer) atol: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). maildir->interval = (guint) atol( param->value ); data/xfce4-mailwatch-plugin-1.3.0/libmailwatch-core/mailwatch-mailbox-mbox.c:302:27: [2] (integer) atol: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). mbox->ctime = atol( p->value ); data/xfce4-mailwatch-plugin-1.3.0/libmailwatch-core/mailwatch-mailbox-mbox.c:305:35: [2] (integer) atol: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). mbox->size = (size_t) atol( p->value ); data/xfce4-mailwatch-plugin-1.3.0/libmailwatch-core/mailwatch-mailbox-mbox.c:308:38: [2] (integer) atol: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). mbox->interval = (guint) atol( p->value ); data/xfce4-mailwatch-plugin-1.3.0/libmailwatch-core/mailwatch-mailbox-mh.c:524:35: [2] (integer) atol: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). mh->timeout = (guint) atol( param->value ); data/xfce4-mailwatch-plugin-1.3.0/libmailwatch-core/mailwatch-mailbox-pop3.c:451:20: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). new_messages = atoi(buf+4); data/xfce4-mailwatch-plugin-1.3.0/libmailwatch-core/mailwatch-mailbox-pop3.c:712:34: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). pmailbox->nonstandard_port = atoi(gtk_editable_get_chars(GTK_EDITABLE(w), 0, -1)); data/xfce4-mailwatch-plugin-1.3.0/libmailwatch-core/mailwatch-mailbox-pop3.c:958:35: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). pmailbox->auth_type = atoi(param->value); data/xfce4-mailwatch-plugin-1.3.0/libmailwatch-core/mailwatch-mailbox-pop3.c:962:42: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). pmailbox->nonstandard_port = atoi(param->value); data/xfce4-mailwatch-plugin-1.3.0/libmailwatch-core/mailwatch-mailbox-pop3.c:964:33: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). pmailbox->timeout = atoi(param->value); data/xfce4-mailwatch-plugin-1.3.0/libmailwatch-core/mailwatch-net-conn.c:802:13: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(buf, net_conn->buffer, bin); data/xfce4-mailwatch-plugin-1.3.0/libmailwatch-core/mailwatch-net-conn.c:816:13: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(buf, net_conn->buffer, bin); data/xfce4-mailwatch-plugin-1.3.0/libmailwatch-core/mailwatch-net-conn.c:894:5: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(buf, net_conn->buffer, bin); data/xfce4-mailwatch-plugin-1.3.0/libmailwatch-core/mailwatch-mailbox-gmail.c:211:51: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). base64_creds = g_base64_encode((guchar *)buf, strlen(buf)); data/xfce4-mailwatch-plugin-1.3.0/libmailwatch-core/mailwatch-mailbox-gmail.c:226:45: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). if(gmail_send(gmailbox, buf) != (gssize)strlen(buf)) { data/xfce4-mailwatch-plugin-1.3.0/libmailwatch-core/mailwatch-mailbox-gmail.c:294:29: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). memmove(buf, p, strlen(p)); data/xfce4-mailwatch-plugin-1.3.0/libmailwatch-core/mailwatch-mailbox-gmail.c:295:24: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). memcpy(buf+strlen(p), buf1, strlen(buf1)); data/xfce4-mailwatch-plugin-1.3.0/libmailwatch-core/mailwatch-mailbox-gmail.c:295:41: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). memcpy(buf+strlen(p), buf1, strlen(buf1)); data/xfce4-mailwatch-plugin-1.3.0/libmailwatch-core/mailwatch-mailbox-gmail.c:296:17: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). buf[strlen(p)+strlen(buf1)] = 0; data/xfce4-mailwatch-plugin-1.3.0/libmailwatch-core/mailwatch-mailbox-gmail.c:296:27: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). buf[strlen(p)+strlen(buf1)] = 0; data/xfce4-mailwatch-plugin-1.3.0/libmailwatch-core/mailwatch-mailbox-imap.c:150:61: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). (guchar *)buf, strlen(buf), data/xfce4-mailwatch-plugin-1.3.0/libmailwatch-core/mailwatch-mailbox-imap.c:271:22: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). if(bout != (gint)strlen(buf)) data/xfce4-mailwatch-plugin-1.3.0/libmailwatch-core/mailwatch-mailbox-imap.c:292:26: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). if(bout != (gint)strlen(buf)) data/xfce4-mailwatch-plugin-1.3.0/libmailwatch-core/mailwatch-mailbox-imap.c:319:30: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). if(bout != (gint)strlen(buf)) data/xfce4-mailwatch-plugin-1.3.0/libmailwatch-core/mailwatch-mailbox-imap.c:352:22: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). if(bout != (gint)strlen(buf)) data/xfce4-mailwatch-plugin-1.3.0/libmailwatch-core/mailwatch-mailbox-imap.c:417:52: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). if(imap_send(imailbox, net_conn, buf) != (gint)strlen(buf)) data/xfce4-mailwatch-plugin-1.3.0/libmailwatch-core/mailwatch-mailbox-imap.c:434:52: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). if(imap_send(imailbox, net_conn, buf) != (gint)strlen(buf)) data/xfce4-mailwatch-plugin-1.3.0/libmailwatch-core/mailwatch-mailbox-imap.c:556:52: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). if(imap_send(imailbox, net_conn, buf) != (gint)strlen(buf)) data/xfce4-mailwatch-plugin-1.3.0/libmailwatch-core/mailwatch-mailbox-imap.c:588:15: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). p = str + strlen(str); data/xfce4-mailwatch-plugin-1.3.0/libmailwatch-core/mailwatch-mailbox-imap.c:605:26: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). room_left = buflen - strlen(buf); data/xfce4-mailwatch-plugin-1.3.0/libmailwatch-core/mailwatch-mailbox-imap.c:917:52: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). if(imap_send(imailbox, net_conn, buf) != (gint)strlen(buf)) data/xfce4-mailwatch-plugin-1.3.0/libmailwatch-core/mailwatch-mailbox-imap.c:949:19: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). p[strlen(p)-1] = 0; data/xfce4-mailwatch-plugin-1.3.0/libmailwatch-core/mailwatch-mailbox-imap.c:986:15: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). p[strlen(p)-1] = 0; data/xfce4-mailwatch-plugin-1.3.0/libmailwatch-core/mailwatch-mailbox-pop3.c:99:61: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). (guchar *)buf, strlen(buf), data/xfce4-mailwatch-plugin-1.3.0/libmailwatch-core/mailwatch-mailbox-pop3.c:193:22: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). if(bout != (gint)strlen(buf)) data/xfce4-mailwatch-plugin-1.3.0/libmailwatch-core/mailwatch-mailbox-pop3.c:206:26: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). if(bout != (gint)strlen(buf)) data/xfce4-mailwatch-plugin-1.3.0/libmailwatch-core/mailwatch-mailbox-pop3.c:232:30: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). if(bout != (gint)strlen(buf)) data/xfce4-mailwatch-plugin-1.3.0/libmailwatch-core/mailwatch-mailbox-pop3.c:259:22: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). if(bout != (gint)strlen(buf)) data/xfce4-mailwatch-plugin-1.3.0/libmailwatch-core/mailwatch-mailbox-pop3.c:272:22: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). if(bout != (gint)strlen(buf)) data/xfce4-mailwatch-plugin-1.3.0/libmailwatch-core/mailwatch-net-conn.c:584:19: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). buf_len = strlen((const gchar *)buf); data/xfce4-mailwatch-plugin-1.3.0/libmailwatch-core/mailwatch-net-conn.c:897:35: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). net_conn->buffer_len -= bin + strlen(net_conn->line_terminator); data/xfce4-mailwatch-plugin-1.3.0/libmailwatch-core/mailwatch-net-conn.c:898:35: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). memmove(net_conn->buffer, p + strlen(net_conn->line_terminator), data/xfce4-mailwatch-plugin-1.3.0/libmailwatch-core/mailwatch-utils.c:71:58: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). (guchar *)password, strlen(password), data/xfce4-mailwatch-plugin-1.3.0/libmailwatch-core/mailwatch-utils.c:77:59: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). response_base64 = g_base64_encode((guchar *)response, strlen(response)); ANALYSIS SUMMARY: Hits = 59 Lines analyzed = 9299 in approximately 0.20 seconds (47550 lines/second) Physical Source Lines of Code (SLOC) = 7009 Hits@level = [0] 1 [1] 31 [2] 25 [3] 2 [4] 0 [5] 1 Hits@level+ = [0+] 60 [1+] 59 [2+] 28 [3+] 3 [4+] 1 [5+] 1 Hits/KSLOC@level+ = [0+] 8.56042 [1+] 8.41775 [2+] 3.99486 [3+] 0.428021 [4+] 0.142674 [5+] 0.142674 Dot directories skipped = 1 (--followdotdir overrides) Minimum risk level = 1 Not every hit is necessarily a security vulnerability. There may be other security vulnerabilities; review your code! See 'Secure Programming HOWTO' (https://dwheeler.com/secure-programs) for more information.