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/hocr-0.10.18/src/ho_segment.c Examining data/hocr-0.10.18/src/ho_array_stat.c Examining data/hocr-0.10.18/src/ho_array_hist.c Examining data/hocr-0.10.18/src/ho_recognize.h Examining data/hocr-0.10.18/src/ho_pixbuf.h Examining data/hocr-0.10.18/src/ho_linguistics.c Examining data/hocr-0.10.18/src/ho_font.h Examining data/hocr-0.10.18/src/ho_bitmap_hist.c Examining data/hocr-0.10.18/src/ho_recognize_font_1.c Examining data/hocr-0.10.18/src/ho_recognize_font_5.h Examining data/hocr-0.10.18/src/ho_recognize_nikud.c Examining data/hocr-0.10.18/src/ho_bitmap_hist.h Examining data/hocr-0.10.18/src/ho_string.c Examining data/hocr-0.10.18/src/ho_array_hist.h Examining data/hocr-0.10.18/src/ho_recognize_font_4.c Examining data/hocr-0.10.18/src/ho_bitmap.c Examining data/hocr-0.10.18/src/ho_string.h Examining data/hocr-0.10.18/src/ho_gtk.h Examining data/hocr-0.10.18/src/hocr.c Examining data/hocr-0.10.18/src/ho_layout.c Examining data/hocr-0.10.18/src/ho_recognize.c Examining data/hocr-0.10.18/src/ho_recognize_font_2.c Examining data/hocr-0.10.18/src/ho_array_stat.h Examining data/hocr-0.10.18/src/ho_array.c Examining data/hocr-0.10.18/src/ho_recognize_nikud.h Examining data/hocr-0.10.18/src/ho_recognize_font_6.h Examining data/hocr-0.10.18/src/ho_font.c Examining data/hocr-0.10.18/src/ho_recognize_font_1.h Examining data/hocr-0.10.18/src/ho_bitmap.h Examining data/hocr-0.10.18/src/hocr.h Examining data/hocr-0.10.18/src/ho_recognize_font_5.c Examining data/hocr-0.10.18/src/ho_recognize_font_6.c Examining data/hocr-0.10.18/src/ho_recognize_font_4.h Examining data/hocr-0.10.18/src/ho_dimentions.h Examining data/hocr-0.10.18/src/ho_segment.h Examining data/hocr-0.10.18/src/ho_recognize_font_2.h Examining data/hocr-0.10.18/src/ho_recognize_font_3.c Examining data/hocr-0.10.18/src/ho_layout.h Examining data/hocr-0.10.18/src/hocrpp.h Examining data/hocr-0.10.18/src/ho_recognize_font_3.h Examining data/hocr-0.10.18/src/ho_linguistics.h Examining data/hocr-0.10.18/src/ho_objmap.c Examining data/hocr-0.10.18/src/ho_dimentions.c Examining data/hocr-0.10.18/src/ho_objmap.h Examining data/hocr-0.10.18/src/ho_gtk.c Examining data/hocr-0.10.18/src/ho_pixbuf.c Examining data/hocr-0.10.18/src/ho_array.h Examining data/hocr-0.10.18/examples/bindings/hocr_cpp.cpp Examining data/hocr-0.10.18/examples/bindings/hocr_c.c Examining data/hocr-0.10.18/examples/hocr/hocr.c FINAL RESULTS: data/hocr-0.10.18/examples/bindings/hocr_c.c:51:3: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. printf (text->string); data/hocr-0.10.18/src/ho_string.c:125:3: [4] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). strcpy (string_buffer->string, new_string); data/hocr-0.10.18/src/ho_string.c:147:3: [4] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). strcpy (new_allocated_string, s_str->string); data/hocr-0.10.18/src/ho_string.c:183:3: [4] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). strcat (string_buffer->string, new_string); data/hocr-0.10.18/src/ho_array.c:114:3: [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 (m_out->data, m->data, m_out->height * m_out->width * sizeof (double)); data/hocr-0.10.18/src/ho_bitmap.c:133:3: [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 (m_out->data, m->data, m_out->height * m_out->rowstride); data/hocr-0.10.18/src/ho_bitmap.c:1422: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. unsigned char neighbors[2][2]; data/hocr-0.10.18/src/ho_bitmap.c:1498:10: [2] (misc) fopen: 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). file = fopen (filename, "wb"); data/hocr-0.10.18/src/ho_font.c:2289:10: [2] (misc) fopen: 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). file = fopen (filename, "wb"); data/hocr-0.10.18/src/ho_gtk.c:53:3: [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 (pix->data, gdk_pixbuf_get_pixels (gdk_pix), data/hocr-0.10.18/src/ho_gtk.c:113:3: [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 (data, pix_color->data, pix_color->height * pix_color->rowstride); data/hocr-0.10.18/src/ho_pixbuf.c:99:3: [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 (m_out->data, m->data, m_out->height * m_out->rowstride); data/hocr-0.10.18/src/ho_pixbuf.c:154:3: [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 (pix->data, data, (pix->height * pix->rowstride)); data/hocr-0.10.18/src/ho_pixbuf.c:173: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 (out.data, pix->data, (pix->height * pix->rowstride)); data/hocr-0.10.18/src/ho_pixbuf.c:492: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. unsigned char neighbors[4]; data/hocr-0.10.18/src/ho_pixbuf.c:530: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. unsigned char neighbors[4]; data/hocr-0.10.18/src/ho_pixbuf.c:1556:12: [2] (misc) fopen: 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). file = fopen (filename, "r"); data/hocr-0.10.18/src/ho_pixbuf.c:1639:10: [2] (misc) fopen: 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). file = fopen (filename, "wb"); data/hocr-0.10.18/src/ho_recognize.h:41:14: [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 const char *ho_sign_array[HO_ARRAY_OUT_SIZE] = data/hocr-0.10.18/src/ho_recognize_nikud.h:41:14: [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 const char *ho_nikud_array[HO_NIKUD_ARRAY_OUT_SIZE] = { "", /* none */ data/hocr-0.10.18/src/hocr.c:266:3: [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 text_out[200]; data/hocr-0.10.18/src/hocr.c:290:7: [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 (text_out, data/hocr-0.10.18/src/ho_pixbuf.c:1466:10: [1] (buffer) getc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ch = getc (file); data/hocr-0.10.18/src/ho_pixbuf.c:1520:12: [1] (buffer) getc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). byte = getc (file); data/hocr-0.10.18/src/ho_string.c:104: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). len = strlen (new_string); data/hocr-0.10.18/src/ho_string.c:126:25: [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). string_buffer->size = strlen (string_buffer->string); data/hocr-0.10.18/src/ho_string.c:137: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). len = strlen (s_str->string); data/hocr-0.10.18/src/ho_string.c:158: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). len = strlen (new_string); data/hocr-0.10.18/src/ho_string.c:184:25: [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). string_buffer->size = strlen (string_buffer->string); ANALYSIS SUMMARY: Hits = 29 Lines analyzed = 27912 in approximately 3.66 seconds (7632 lines/second) Physical Source Lines of Code (SLOC) = 18106 Hits@level = [0] 6 [1] 7 [2] 18 [3] 0 [4] 4 [5] 0 Hits@level+ = [0+] 35 [1+] 29 [2+] 22 [3+] 4 [4+] 4 [5+] 0 Hits/KSLOC@level+ = [0+] 1.93306 [1+] 1.60168 [2+] 1.21507 [3+] 0.220921 [4+] 0.220921 [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.