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/granule-1.4.0-7/src/Intern.h Examining data/granule-1.4.0-7/src/CSVImportDialog.h Examining data/granule-1.4.0-7/src/CSVExportDialog.h Examining data/granule-1.4.0-7/src/AboutGRAPP.h Examining data/granule-1.4.0-7/src/AboutGRAPP.cpp Examining data/granule-1.4.0-7/src/AppearanceDB.h Examining data/granule-1.4.0-7/src/FontsSelectorUI.h Examining data/granule-1.4.0-7/src/FontsSelectorUI.cpp Examining data/granule-1.4.0-7/src/ColorsSelectorUI.h Examining data/granule-1.4.0-7/src/ColorsSelectorUI.cpp Examining data/granule-1.4.0-7/src/VDeck.h Examining data/granule-1.4.0-7/src/CardDeck.h Examining data/granule-1.4.0-7/src/CardDeck.cpp Examining data/granule-1.4.0-7/src/Deck.h Examining data/granule-1.4.0-7/src/Deck.cpp Examining data/granule-1.4.0-7/src/CardBox.h Examining data/granule-1.4.0-7/src/CardBox.cpp Examining data/granule-1.4.0-7/src/DeckView.h Examining data/granule-1.4.0-7/src/DeckView.cpp Examining data/granule-1.4.0-7/src/DeckInfo.h Examining data/granule-1.4.0-7/src/DeckInfo.cpp Examining data/granule-1.4.0-7/src/DeckPlayer.h Examining data/granule-1.4.0-7/src/VerifyControl.h Examining data/granule-1.4.0-7/src/VerifyControl.cpp Examining data/granule-1.4.0-7/src/DeckManager.cpp Examining data/granule-1.4.0-7/src/DeckList.h Examining data/granule-1.4.0-7/src/DeckList.cpp Examining data/granule-1.4.0-7/src/DialogWithCheckbutton.h Examining data/granule-1.4.0-7/src/DialogWithCheckbutton.cpp Examining data/granule-1.4.0-7/src/VCard.h Examining data/granule-1.4.0-7/src/VCard.cpp Examining data/granule-1.4.0-7/src/CardRef.h Examining data/granule-1.4.0-7/src/CardRef.cpp Examining data/granule-1.4.0-7/src/Card.h Examining data/granule-1.4.0-7/src/Card.cpp Examining data/granule-1.4.0-7/src/CardView.h Examining data/granule-1.4.0-7/src/CardView.cpp Examining data/granule-1.4.0-7/src/CardViewHelpDialog.h Examining data/granule-1.4.0-7/src/AutoFillDB.h Examining data/granule-1.4.0-7/src/AutoFillDB.cpp Examining data/granule-1.4.0-7/src/CardAutoFill.h Examining data/granule-1.4.0-7/src/CardAutoFill.cpp Examining data/granule-1.4.0-7/src/EditControls.h Examining data/granule-1.4.0-7/src/FileOpen.h Examining data/granule-1.4.0-7/src/FileOpenDialog.h Examining data/granule-1.4.0-7/src/FileOpenDialog.cpp Examining data/granule-1.4.0-7/src/FileSaveDialog.h Examining data/granule-1.4.0-7/src/FileSaveDialog.cpp Examining data/granule-1.4.0-7/src/FolderChooseDialog.h Examining data/granule-1.4.0-7/src/FolderChooseDialog.cpp Examining data/granule-1.4.0-7/src/InputDialog.h Examining data/granule-1.4.0-7/src/InputDialog.cpp Examining data/granule-1.4.0-7/src/GrappConf.h Examining data/granule-1.4.0-7/src/GrappConf.cpp Examining data/granule-1.4.0-7/src/FontsDB.h Examining data/granule-1.4.0-7/src/FontsDB.cpp Examining data/granule-1.4.0-7/src/TextColorsDB.h Examining data/granule-1.4.0-7/src/TextColorsDB.cpp Examining data/granule-1.4.0-7/src/TopMenuBar.cpp Examining data/granule-1.4.0-7/src/GeneralPref.h Examining data/granule-1.4.0-7/src/GeneralPref.cpp Examining data/granule-1.4.0-7/src/CardBoxPrefsWindow.h Examining data/granule-1.4.0-7/src/CardBoxPrefsWindow.cpp Examining data/granule-1.4.0-7/src/SchedulingPrefs.h Examining data/granule-1.4.0-7/src/SchedulingPrefs.cpp Examining data/granule-1.4.0-7/src/ScheduleDB.h Examining data/granule-1.4.0-7/src/ScheduleUI.h Examining data/granule-1.4.0-7/src/ScheduleUI.cpp Examining data/granule-1.4.0-7/src/SoundPrefs.h Examining data/granule-1.4.0-7/src/SoundPrefs.cpp Examining data/granule-1.4.0-7/src/GeometryPrefs.h Examining data/granule-1.4.0-7/src/GeometryPrefs.cpp Examining data/granule-1.4.0-7/src/AppearancePrefs.h Examining data/granule-1.4.0-7/src/AppearancePrefs.cpp Examining data/granule-1.4.0-7/src/TextAlignmentsUI.h Examining data/granule-1.4.0-7/src/TextAlignmentsUI.cpp Examining data/granule-1.4.0-7/src/TextAlignment.h Examining data/granule-1.4.0-7/src/TextAlignment.cpp Examining data/granule-1.4.0-7/src/PrefWindow.h Examining data/granule-1.4.0-7/src/PrefWindow.cpp Examining data/granule-1.4.0-7/src/PropertyBox.h Examining data/granule-1.4.0-7/src/PropertyBox.cpp Examining data/granule-1.4.0-7/src/ButtonWithImageLabel.h Examining data/granule-1.4.0-7/src/ButtonWithImageLabel.cpp Examining data/granule-1.4.0-7/src/MainWindow.h Examining data/granule-1.4.0-7/src/MainWindow.cpp Examining data/granule-1.4.0-7/src/Granule.h Examining data/granule-1.4.0-7/src/Granule-main.h Examining data/granule-1.4.0-7/src/Granule-main.cpp Examining data/granule-1.4.0-7/src/DeckManager.h Examining data/granule-1.4.0-7/src/AppearanceDB.cpp Examining data/granule-1.4.0-7/src/CSVExportDialog.cpp Examining data/granule-1.4.0-7/src/CSVImportDialog.cpp Examining data/granule-1.4.0-7/src/Granule.cpp Examining data/granule-1.4.0-7/src/ScheduleDB.cpp Examining data/granule-1.4.0-7/src/CardViewHelpDialog.cpp Examining data/granule-1.4.0-7/src/DeckPlayer.cpp Examining data/granule-1.4.0-7/src/EditControls.cpp Examining data/granule-1.4.0-7/src/TopMenuBar.h FINAL RESULTS: data/granule-1.4.0-7/src/AutoFillDB.cpp:80:3: [4] (format) snprintf: If format strings can be influenced by an attacker, they can be exploited, and note that sprintf variations do not always \0-terminate (CWE-134). Use a constant for the format specification. snprintf (buffer, sizeof(buffer)-1, pattern.c_str (), seqnum_); data/granule-1.4.0-7/src/AutoFillDB.cpp:86:3: [4] (format) snprintf: If format strings can be influenced by an attacker, they can be exploited, and note that sprintf variations do not always \0-terminate (CWE-134). Use a constant for the format specification. snprintf (buffer, sizeof(buffer)-1, pattern.c_str (), seqnum_); data/granule-1.4.0-7/src/AutoFillDB.cpp:92:3: [4] (format) snprintf: If format strings can be influenced by an attacker, they can be exploited, and note that sprintf variations do not always \0-terminate (CWE-134). Use a constant for the format specification. snprintf (buffer, sizeof(buffer)-1, pattern.c_str (), seqnum_); data/granule-1.4.0-7/src/CardRef.cpp:216:2: [4] (format) snprintf: If format strings can be influenced by an attacker, they can be exploited, and note that sprintf variations do not always \0-terminate (CWE-134). Use a constant for the format specification. snprintf (buf, SBUF_SZ, format_, value_); data/granule-1.4.0-7/src/CardRef.cpp:228:2: [4] (format) snprintf: If format strings can be influenced by an attacker, they can be exploited, and note that sprintf variations do not always \0-terminate (CWE-134). Use a constant for the format specification. snprintf (buf, SBUF_SZ, format_, value_); data/granule-1.4.0-7/src/CardView.cpp:1225:3: [4] (format) snprintf: If format strings can be influenced by an attacker, they can be exploited, and note that sprintf variations do not always \0-terminate (CWE-134). Use a constant for the format specification. snprintf (buffer, sizeof(buffer)-1, pattern.c_str (), seqnum_); data/granule-1.4.0-7/src/CardView.cpp:1231:3: [4] (format) snprintf: If format strings can be influenced by an attacker, they can be exploited, and note that sprintf variations do not always \0-terminate (CWE-134). Use a constant for the format specification. snprintf (buffer, sizeof(buffer)-1, pattern.c_str (), seqnum_); data/granule-1.4.0-7/src/CardView.cpp:1237:3: [4] (format) snprintf: If format strings can be influenced by an attacker, they can be exploited, and note that sprintf variations do not always \0-terminate (CWE-134). Use a constant for the format specification. snprintf (buffer, sizeof(buffer)-1, pattern.c_str (), seqnum_); data/granule-1.4.0-7/src/Deck.cpp:509:2: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf (failed_fname, "%s.failed", file_.c_str ()); data/granule-1.4.0-7/src/Deck.cpp:713:3: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf (inbuf, "Successful records parsed: %d\n" data/granule-1.4.0-7/src/Deck.cpp:1591:2: [4] (format) snprintf: If format strings can be influenced by an attacker, they can be exploited, and note that sprintf variations do not always \0-terminate (CWE-134). Use a constant for the format specification. snprintf (execmdbuf, PATH_MAX, cmd_args.c_str (), sound_fname.c_str ()); data/granule-1.4.0-7/src/Deck.cpp:1615:3: [4] (format) snprintf: If format strings can be influenced by an attacker, they can be exploited, and note that sprintf variations do not always \0-terminate (CWE-134). Use a constant for the format specification. snprintf (execmdbuf+n, PATH_MAX-n, data/granule-1.4.0-7/src/Granule.cpp:140:9: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. if (::access (rcfile.c_str (), R_OK) < 0) { data/granule-1.4.0-7/src/Granule.cpp:141:10: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. if (::access (defaultrc.c_str (), R_OK) == 0) { data/granule-1.4.0-7/src/Granule.cpp:144:11: [4] (shell) system: This causes a new program to execute and is difficult to use safely (CWE-78). try using a library call that implements the same functionality if available. if (::system (cmd.c_str ()) < 0) { data/granule-1.4.0-7/src/GrappConf.cpp:111:23: [4] (misc) cuserid: Exactly what cuserid() does is poorly defined (e.g., some systems use the effective uid, like Linux, while others like System V use the real uid). Thus, you can't trust what it does. It's certainly not portable (The cuserid function was included in the 1988 version of POSIX, but removed from the 1990 version). Also, if passed a non-null parameter, there's a risk of a buffer overflow if the passed-in buffer is not at least L_cuserid characters long (CWE-120). Use getpwuid(geteuid()) and extract the desired information instead. char* login_name = ::cuserid (NULL); data/granule-1.4.0-7/src/Granule-main.cpp:147:22: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They 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. char* bus_address = getenv ("DBUS_SESSION_BUS_ADDRESS"); data/granule-1.4.0-7/src/AutoFillDB.cpp:70:9: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. static char buffer [1024]; data/granule-1.4.0-7/src/CardBox.cpp:361:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char total_count [32]; data/granule-1.4.0-7/src/CardBox.cpp:362:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char xpath [64]; data/granule-1.4.0-7/src/CardBox.cpp:410:3: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf(xpath, "/cardfile/carddeck[%d]/@side", i+1); data/granule-1.4.0-7/src/CardBox.cpp:425:4: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf(xpath, "/cardfile/carddeck[%d]/card[%d]", i+1, ccount); data/granule-1.4.0-7/src/CardBox.cpp:434:4: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf (xpath, "/cardfile/carddeck[%d]/card[%d]/@id", i+1, ccount); data/granule-1.4.0-7/src/CardBox.cpp:442:16: [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). card_id = ::atol ((attr_node.substr (1)).c_str ()); data/granule-1.4.0-7/src/CardBox.cpp:448:4: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf (xpath, "/cardfile/carddeck[%d]/card[%d]/@reverse", data/granule-1.4.0-7/src/CardBox.cpp:460:4: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf (xpath, "/cardfile/carddeck[%d]/card[%d]/expdate", data/granule-1.4.0-7/src/CardBox.cpp:467:21: [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). exp_time.sec (::atol ((const char*) result)); data/granule-1.4.0-7/src/CardBox.cpp:473:4: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf (xpath, "/cardfile/carddeck[%d]/card[%d]/fromdeck", data/granule-1.4.0-7/src/CardBox.cpp:516:3: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf (total_count, "%d cards", cloaded); data/granule-1.4.0-7/src/CardRef.cpp:28:8: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. static char sbuf [SBUF_SZ]; data/granule-1.4.0-7/src/CardRef.cpp:117:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char xpath [64]; data/granule-1.4.0-7/src/CardRef.cpp:120:6: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. n = sprintf (xpath, "/cardfile/carddeck[%d]/card[%d]/", deck_+1, card_); data/granule-1.4.0-7/src/CardRef.cpp:125:2: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf (attrp, "efactor"); data/granule-1.4.0-7/src/CardRef.cpp:134:2: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf (attrp, "interval"); data/granule-1.4.0-7/src/CardRef.cpp:137:18: [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). m_interval = ::atoi ((const char*) result); data/granule-1.4.0-7/src/CardRef.cpp:143:2: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf (attrp, "repetition"); data/granule-1.4.0-7/src/CardRef.cpp:146: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). m_repetition = ::atoi ((const char*) result); data/granule-1.4.0-7/src/CardRef.cpp:152:6: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. n = sprintf (attrp, "statistics/"); data/granule-1.4.0-7/src/CardRef.cpp:156:3: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf (attrp, "@qs%d", i); data/granule-1.4.0-7/src/CardRef.cpp:159:25: [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). m_statistics [i] = ::atoi ((const char*) result); data/granule-1.4.0-7/src/CardRef.cpp:215:9: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. static char buf [32]; data/granule-1.4.0-7/src/CardRef.cpp:227:9: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. static char buf [32]; data/granule-1.4.0-7/src/CardRef.cpp:358:9: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. static char buffer [32]; data/granule-1.4.0-7/src/CardView.cpp:1216:9: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. static char buffer [1024]; data/granule-1.4.0-7/src/ColorsSelectorUI.cpp:182:2: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf (&color_string[1], "%.2X", color_.get_red () / 256); data/granule-1.4.0-7/src/ColorsSelectorUI.cpp:183:2: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf (&color_string[3], "%.2X", color_.get_green () / 256); data/granule-1.4.0-7/src/ColorsSelectorUI.cpp:184:2: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf (&color_string[5], "%.2X", color_.get_blue () / 256); data/granule-1.4.0-7/src/Deck.cpp:220:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char buffer [1024]; data/granule-1.4.0-7/src/Deck.cpp:221:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char xpath [64]; data/granule-1.4.0-7/src/Deck.cpp:320:3: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf (xpath, "/deck/card[%d]", cards_counter); data/granule-1.4.0-7/src/Deck.cpp:331:3: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf (xpath, "/deck/card[%d]/@id", cards_counter); data/granule-1.4.0-7/src/Deck.cpp:339:19: [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). card->set_id (::atol ((const char*) result+1)); data/granule-1.4.0-7/src/Deck.cpp:343:3: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf (xpath, "/deck/card[%d]/front", cards_counter); data/granule-1.4.0-7/src/Deck.cpp:347:4: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf (buffer, "<span foreground=\"red\" size=\"large\" " data/granule-1.4.0-7/src/Deck.cpp:359:3: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf (xpath, "/deck/card[%d]/front/@alt_spelling", cards_counter); data/granule-1.4.0-7/src/Deck.cpp:367:3: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf (xpath, "/deck/card[%d]/front/@image", cards_counter); data/granule-1.4.0-7/src/Deck.cpp:375:3: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf (xpath, "/deck/card[%d]/back", cards_counter); data/granule-1.4.0-7/src/Deck.cpp:383:3: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf (xpath, "/deck/card[%d]/back/@alt_spelling", cards_counter); data/granule-1.4.0-7/src/Deck.cpp:393:3: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf (xpath, "/deck/card[%d]/back_example", cards_counter); data/granule-1.4.0-7/src/Deck.cpp:400:3: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf (xpath, "/deck/card[%d]/back_example/@image", cards_counter); data/granule-1.4.0-7/src/Deck.cpp:470:12: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. static char inbuf [size]; data/granule-1.4.0-7/src/Deck.cpp:471:9: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. static char failed_fname [size]; data/granule-1.4.0-7/src/Deck.cpp:499:9: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). source.open (file_.c_str (), std::ios::in); data/granule-1.4.0-7/src/Deck.cpp:510:10: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). ffailed.open (failed_fname, std::ios::out); data/granule-1.4.0-7/src/Deck.cpp:710:3: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf (inbuf, "Successful records parsed: %d\n", ok_count); data/granule-1.4.0-7/src/Deck.cpp:884:7: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). sink.open (file_.c_str (), std::ios::out); data/granule-1.4.0-7/src/Deck.cpp:955:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char msg [64]; data/granule-1.4.0-7/src/Deck.cpp:956:2: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf (msg, "Saved %d CSV records", ok_count); data/granule-1.4.0-7/src/Deck.cpp:1523:9: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. static char execmdbuf [PATH_MAX]; data/granule-1.4.0-7/src/Deck.cpp:1682:31: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). Deck::s_pipe_stream = pipe->open (w.c_str (), "r"); data/granule-1.4.0-7/src/Deck.cpp:1709:9: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. static char buf [1024]; data/granule-1.4.0-7/src/Deck.cpp:1861:29: [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). m_current_card->set_id (atol (value.substr (1, value.size ()))); data/granule-1.4.0-7/src/DeckPlayer.cpp:91:12: [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). return (::atoi (s_.c_str ())); data/granule-1.4.0-7/src/EditControls.cpp:519: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). m_index_count = ::atoi (idx_val.c_str ()); data/granule-1.4.0-7/src/GeneralPref.cpp:69:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char buf[24]; data/granule-1.4.0-7/src/GeneralPref.cpp:70:2: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf (buf, "%d", v_); data/granule-1.4.0-7/src/GeneralPref.cpp:78:12: [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). return (::atoi (m_entry->get_text ().c_str ())); data/granule-1.4.0-7/src/GeometryPrefs.cpp:199:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char buf [16]; data/granule-1.4.0-7/src/GeometryPrefs.cpp:202:2: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf (buf, "%d", int (aspect_.get_width ())); data/granule-1.4.0-7/src/GeometryPrefs.cpp:205:2: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf (buf, "%d", int (aspect_.get_height ())); data/granule-1.4.0-7/src/Granule.cpp:987:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char buf [PATH_MAX]; data/granule-1.4.0-7/src/Granule.cpp:1009:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char buf [PATH_MAX]; data/granule-1.4.0-7/src/GrappConf.cpp:51:24: [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). ASSA::TimeVal hhmm (::atoi (m_hours.c_str ()) * 360 + data/granule-1.4.0-7/src/GrappConf.cpp:52:9: [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). ::atoi (m_mins.c_str ()) * 60); data/granule-1.4.0-7/src/GrappConf.cpp:54: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). ASSA::TimeVal (::atoi (m_days.c_str ()) * secs_in_day_) + data/granule-1.4.0-7/src/GrappConf.cpp:55: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). ASSA::TimeVal (::atoi (m_weeks.c_str ()) * secs_in_week_) + data/granule-1.4.0-7/src/GrappConf.cpp:404:12: [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). idx = ::atoi ((*k).first.c_str ()) - 1; data/granule-1.4.0-7/src/GrappConf.cpp:456:21: [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). m_history_size = ::atoi (m_config->get_value ("Default", data/granule-1.4.0-7/src/GrappConf.cpp:548:23: [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). m_sidebar_width = ::atoi (s.c_str ()); data/granule-1.4.0-7/src/GrappConf.cpp:556: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). m_root_x = ::atoi (m_config->get_value ("Default", "root_x").c_str ()); data/granule-1.4.0-7/src/GrappConf.cpp:557:18: [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). m_root_y = ::atoi (m_config->get_value ("Default", "root_y").c_str ()); data/granule-1.4.0-7/src/GrappConf.cpp:579:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char buf[32]; data/granule-1.4.0-7/src/GrappConf.cpp:726:2: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf (buf, "%d", m_history_size); data/granule-1.4.0-7/src/GrappConf.cpp:729:5: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf (buf, "%d", m_root_x); data/granule-1.4.0-7/src/GrappConf.cpp:731:5: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf (buf, "%d", m_root_y); data/granule-1.4.0-7/src/GrappConf.cpp:845:12: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. static char buf [26]; data/granule-1.4.0-7/src/GrappConf.cpp:846:5: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf (buf, "%dx%d", aspect_.get_height (), aspect_.get_width ()); data/granule-1.4.0-7/src/ScheduleDB.cpp:297:9: [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 ((const char*) result); data/granule-1.4.0-7/src/ScheduleDB.cpp:315:9: [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 ((const char*) result); data/granule-1.4.0-7/src/ScheduleDB.cpp:332:9: [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 ((const char*) result); data/granule-1.4.0-7/src/ScheduleDB.cpp:352:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char buf [32]; data/granule-1.4.0-7/src/Deck.cpp:245:7: [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 (strlen ((const char*) result) != 0) { data/granule-1.4.0-7/src/Deck.cpp:523:9: [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 (::strlen (inbuf) == 0 && !bracket_flag) { data/granule-1.4.0-7/src/Deck.cpp:529: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 (impd.is_windoz_linebreak () && inbuf [strlen (inbuf)-1] == 0x0D) { data/granule-1.4.0-7/src/Deck.cpp:530:11: [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). inbuf [strlen (inbuf)-1] = '\0'; data/granule-1.4.0-7/src/Deck.cpp:1607: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 (cmd != NULL && strlen (cmd) != 0) data/granule-1.4.0-7/src/Deck.cpp:1671:21: [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 (cmd != NULL && strlen (cmd) != 0) data/granule-1.4.0-7/src/Deck.cpp:1712:16: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if ((ret = ::read (fd_, buf, 1024)) < 0) { data/granule-1.4.0-7/src/Granule.cpp:524: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). if (src_ == NULL || ::strlen (src_) == 0) { data/granule-1.4.0-7/src/Granule.cpp:594:34: [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). gchar* chp = g_strdup (src_ + strlen (prefixes [i])); data/granule-1.4.0-7/src/Granule.cpp:995:4: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). ::strncpy (buf, path_, PATH_MAX-1); data/granule-1.4.0-7/src/Granule.cpp:1017:4: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). ::strncpy (buf, path_, PATH_MAX-1); data/granule-1.4.0-7/src/SoundPrefs.cpp:199:18: [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 (snd_path && strlen (snd_path)) { ANALYSIS SUMMARY: Hits = 113 Lines analyzed = 29293 in approximately 0.69 seconds (42706 lines/second) Physical Source Lines of Code (SLOC) = 19244 Hits@level = [0] 12 [1] 12 [2] 84 [3] 1 [4] 16 [5] 0 Hits@level+ = [0+] 125 [1+] 113 [2+] 101 [3+] 17 [4+] 16 [5+] 0 Hits/KSLOC@level+ = [0+] 6.49553 [1+] 5.87196 [2+] 5.24839 [3+] 0.883392 [4+] 0.831428 [5+] 0 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.