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/tinyows-1.1.1/src/fe/fe_comparison_ops.c Examining data/tinyows-1.1.1/src/fe/fe_error.c Examining data/tinyows-1.1.1/src/fe/fe_filter.c Examining data/tinyows-1.1.1/src/fe/fe_filter_capabilities.c Examining data/tinyows-1.1.1/src/fe/fe_function.c Examining data/tinyows-1.1.1/src/fe/fe_logical_ops.c Examining data/tinyows-1.1.1/src/fe/fe_spatial_ops.c Examining data/tinyows-1.1.1/src/mapfile/mapfile.c Examining data/tinyows-1.1.1/src/ows/ows.c Examining data/tinyows-1.1.1/src/ows/ows.h Examining data/tinyows-1.1.1/src/ows/ows_bbox.c Examining data/tinyows-1.1.1/src/ows/ows_config.c Examining data/tinyows-1.1.1/src/ows/ows_error.c Examining data/tinyows-1.1.1/src/ows/ows_geobbox.c Examining data/tinyows-1.1.1/src/ows/ows_get_capabilities.c Examining data/tinyows-1.1.1/src/ows/ows_layer.c Examining data/tinyows-1.1.1/src/ows/ows_libxml.c Examining data/tinyows-1.1.1/src/ows/ows_metadata.c Examining data/tinyows-1.1.1/src/ows/ows_psql.c Examining data/tinyows-1.1.1/src/ows/ows_request.c Examining data/tinyows-1.1.1/src/ows/ows_srs.c Examining data/tinyows-1.1.1/src/ows/ows_storage.c Examining data/tinyows-1.1.1/src/ows/ows_version.c Examining data/tinyows-1.1.1/src/ows_api.h Examining data/tinyows-1.1.1/src/ows_struct.h Examining data/tinyows-1.1.1/src/struct/alist.c Examining data/tinyows-1.1.1/src/struct/array.c Examining data/tinyows-1.1.1/src/struct/buffer.c Examining data/tinyows-1.1.1/src/struct/list.c Examining data/tinyows-1.1.1/src/struct/mlist.c Examining data/tinyows-1.1.1/src/struct/regexp.c Examining data/tinyows-1.1.1/src/struct/cgi_request.c Examining data/tinyows-1.1.1/src/wfs/wfs_describe.c Examining data/tinyows-1.1.1/src/wfs/wfs_error.c Examining data/tinyows-1.1.1/src/wfs/wfs_get_capabilities.c Examining data/tinyows-1.1.1/src/wfs/wfs_get_feature.c Examining data/tinyows-1.1.1/src/wfs/wfs_request.c Examining data/tinyows-1.1.1/src/wfs/wfs_transaction.c FINAL RESULTS: data/tinyows-1.1.1/src/ows/ows_psql.c:634:7: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(seed,"%s%03d", seed, fgetc(fp)); data/tinyows-1.1.1/src/struct/buffer.c:259: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(buf->buf, str); data/tinyows-1.1.1/src/ows/ows.c:315:24: [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. if ( !strcmp(getenv("CONTENT_TYPE"), "application/x-www-form-urlencoded") data/tinyows-1.1.1/src/ows/ows.c:316:28: [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. || !strncmp(getenv("CONTENT_TYPE"), "application/x-www-form-urlencoded;", 34)) data/tinyows-1.1.1/src/ows/ows.c:318:26: [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. else if ( !strcmp(getenv("CONTENT_TYPE"), "text/xml") data/tinyows-1.1.1/src/ows/ows.c:319:30: [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. || !strncmp(getenv("CONTENT_TYPE"), "text/xml;", 9)) /* Allowing charset */ data/tinyows-1.1.1/src/ows/ows.c:323:26: [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. else if ( !strcmp(getenv("CONTENT_TYPE"), "application/xml") data/tinyows-1.1.1/src/ows/ows.c:324:29: [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. || !strcmp(getenv("CONTENT_TYPE"), "text/plain") data/tinyows-1.1.1/src/ows/ows.c:325:30: [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. || !strncmp(getenv("CONTENT_TYPE"), "application/xml;", 16) /* Allowing charset */ data/tinyows-1.1.1/src/ows/ows.c:326:30: [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. || !strncmp(getenv("CONTENT_TYPE"), "text/plain;", 11)) /* Allowing charset */ data/tinyows-1.1.1/src/ows/ows.c:348:7: [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. if (getenv("TINYOWS_CONFIG_FILE")) data/tinyows-1.1.1/src/ows/ows.c:349:36: [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. buffer_add_str(o->config_file, getenv("TINYOWS_CONFIG_FILE")); data/tinyows-1.1.1/src/ows/ows.c:350:12: [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. else if (getenv("TINYOWS_MAPFILE")) { data/tinyows-1.1.1/src/ows/ows.c:351:36: [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. buffer_add_str(o->config_file, getenv("TINYOWS_MAPFILE")); data/tinyows-1.1.1/src/ows/ows_psql.c:648:3: [3] (random) srand: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. srand((int) (time(NULL) ^ rand() % 1000) + 42); data/tinyows-1.1.1/src/ows/ows_psql.c:649:3: [3] (random) srand: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. srand((rand() % 1000 ^ rand() % 1000) + 42); data/tinyows-1.1.1/src/ows/ows_request.c:386:43: [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. if ( (cgi_method_post() && ( !strcmp(getenv("CONTENT_TYPE"), "application/xml; charset=UTF-8") data/tinyows-1.1.1/src/ows/ows_request.c:387:43: [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. || !strcmp(getenv("CONTENT_TYPE"), "application/xml") data/tinyows-1.1.1/src/ows/ows_request.c:388:43: [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. || !strcmp(getenv("CONTENT_TYPE"), "text/xml") data/tinyows-1.1.1/src/ows/ows_request.c:389:43: [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. || !strcmp(getenv("CONTENT_TYPE"), "text/plain"))) data/tinyows-1.1.1/src/struct/cgi_request.c:46:12: [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. method = getenv("REQUEST_METHOD"); data/tinyows-1.1.1/src/struct/cgi_request.c:59:12: [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. method = getenv("REQUEST_METHOD"); data/tinyows-1.1.1/src/struct/cgi_request.c:74:33: [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. if (cgi_method_get()) query = getenv("QUERY_STRING"); data/tinyows-1.1.1/src/struct/cgi_request.c:76:23: [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. query_size = atoi(getenv("CONTENT_LENGTH")); data/tinyows-1.1.1/src/struct/cgi_request.c:91:16: [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. else query = getenv("QUERY_STRING"); data/tinyows-1.1.1/src/fe/fe_filter.c:197:49: [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). prop_name = ows_psql_column_name(o, typename, atoi(property->buf)); data/tinyows-1.1.1/src/mapfile/mapfile.c:1306:26: [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). map_o->max_features = atoi(yytext); data/tinyows-1.1.1/src/mapfile/mapfile.c:1373:8: [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). i = atoi(yytext); data/tinyows-1.1.1/src/mapfile/mapfile.c:1380:8: [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). i = atoi(yytext); data/tinyows-1.1.1/src/mapfile/mapfile.c:1384:8: [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). i = atoi(yytext); data/tinyows-1.1.1/src/mapfile/mapfile.c:1388: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). if (!atoi(yytext)) map_o->display_bbox = false; data/tinyows-1.1.1/src/mapfile/mapfile.c:1391:8: [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). if (atoi(yytext)) map_o->estimated_extent = true; data/tinyows-1.1.1/src/mapfile/mapfile.c:1394: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). if (!atoi(yytext)) map_o->check_schema = false; data/tinyows-1.1.1/src/mapfile/mapfile.c:1397: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). if (!atoi(yytext)) map_o->check_valid_geom = false; data/tinyows-1.1.1/src/mapfile/mapfile.c:1400:8: [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). if (atoi(yytext)) map_o->check_valid_geom = true; data/tinyows-1.1.1/src/mapfile/mapfile.c:1524:19: [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). map_l->writable=atoi(yytext)?1:0; data/tinyows-1.1.1/src/mapfile/mapfile.c:1527:22: [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). map_l->retrievable=atoi(yytext)?1:0; data/tinyows-1.1.1/src/mapfile/mapfile.c:2467:17: [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). yyin = fopen(path->buf, "r"); data/tinyows-1.1.1/src/mapfile/mapfile.c:3579:15: [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). if (!(yyin = fopen(filename, "r"))) { data/tinyows-1.1.1/src/ows/ows.c:240:40: [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). if (o->log_file && !o->log) o->log = fopen(o->log_file->buf, "a"); data/tinyows-1.1.1/src/ows/ows_config.c:64:17: [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). log_level = atoi((char *) a); data/tinyows-1.1.1/src/ows/ows_config.c:71:17: [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). precision = atoi((char *) a); data/tinyows-1.1.1/src/ows/ows_config.c:78:17: [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). precision = atoi((char *) a); data/tinyows-1.1.1/src/ows/ows_config.c:85:10: [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). if (!atoi((char *) a)) o->display_bbox = false; data/tinyows-1.1.1/src/ows/ows_config.c:91: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). if (atoi((char *) a)) o->estimated_extent = true; data/tinyows-1.1.1/src/ows/ows_config.c:97:10: [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). if (!atoi((char *) a)) o->check_schema = false; data/tinyows-1.1.1/src/ows/ows_config.c:103:10: [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). if (!atoi((char *) a)) o->check_valid_geom = false; data/tinyows-1.1.1/src/ows/ows_config.c:115: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). if (atoi((char *) a)) o->expose_pk = true; data/tinyows-1.1.1/src/ows/ows_config.c:331: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). o->max_features = atoi((char *) a); data/tinyows-1.1.1/src/ows/ows_config.c:486: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). if (a && atoi((char *) a) == 1) { data/tinyows-1.1.1/src/ows/ows_config.c:494: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). if (a && atoi((char *) a) == 1) { data/tinyows-1.1.1/src/ows/ows_geobbox.c:62:10: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. return memcpy(c, g, sizeof(g)); data/tinyows-1.1.1/src/ows/ows_psql.c:433: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). v->major = atoi(l->first->value->buf); data/tinyows-1.1.1/src/ows/ows_psql.c:434: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). v->minor = atoi(l->first->next->value->buf); data/tinyows-1.1.1/src/ows/ows_psql.c:435: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). v->release = atoi(l->last->value->buf); data/tinyows-1.1.1/src/ows/ows_psql.c:631:8: [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). fp = fopen("/dev/urandom","r"); data/tinyows-1.1.1/src/ows/ows_psql.c:693: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). nb = nb + atoi(PQgetvalue(res, 0, 0)); data/tinyows-1.1.1/src/ows/ows_psql.c:865: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). else srid = atoi((char *) PQgetvalue(res, 0, 0)); data/tinyows-1.1.1/src/ows/ows_request.c:242: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). v->major = atoi(l->first->value->buf); data/tinyows-1.1.1/src/ows/ows_request.c:243: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). v->minor = atoi(l->first->next->value->buf); data/tinyows-1.1.1/src/ows/ows_request.c:244: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). v->release = atoi(l->first->next->next->value->buf); data/tinyows-1.1.1/src/ows/ows_srs.c:156:13: [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). c->srid = atoi(PQgetvalue(res, 0, 0)); data/tinyows-1.1.1/src/ows/ows_srs.c:159:7: [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). if (atoi(PQgetvalue(res, 0, 1)) == 0) data/tinyows-1.1.1/src/ows/ows_srs.c:165:7: [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). if (atoi(PQgetvalue(res, 0, 2)) != 0) data/tinyows-1.1.1/src/ows/ows_srs.c:234: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). s->auth_srid = atoi(PQgetvalue(res, 0, 1)); data/tinyows-1.1.1/src/ows/ows_srs.c:238:7: [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). if (atoi(PQgetvalue(res, 0, 2)) == 0) data/tinyows-1.1.1/src/ows/ows_srs.c:244:7: [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). if (atoi(PQgetvalue(res, 0, 3)) != 0) data/tinyows-1.1.1/src/ows/ows_srs.c:304:10: [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). srid = atoi(++p); data/tinyows-1.1.1/src/ows/ows_srs.c:364:36: [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). b = ows_srs_get_from_a_srid(o, atoi(ln->value->buf)); data/tinyows-1.1.1/src/ows/ows_storage.c:246:38: [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). l->storage->pkey_column_number = atoi(PQgetvalue(res, 0, 0)) - 1; data/tinyows-1.1.1/src/ows/ows_storage.c:449:22: [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). l->storage->srid = atoi(PQgetvalue(res, 0, 0)); data/tinyows-1.1.1/src/struct/buffer.c:191: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(res->buf, "%i", i); data/tinyows-1.1.1/src/struct/cgi_request.c:76: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). query_size = atoi(getenv("CONTENT_LENGTH")); data/tinyows-1.1.1/src/struct/cgi_request.c:165: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 string[2]; data/tinyows-1.1.1/src/wfs/wfs_get_feature.c:328: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). hits = hits + atoi(PQgetvalue(res, 0, 0)); data/tinyows-1.1.1/src/wfs/wfs_get_feature.c:729: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). if (features + atoi(PQgetvalue(res, 0, 0)) <= max_features) { data/tinyows-1.1.1/src/wfs/wfs_get_feature.c:734: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). features += atoi(PQgetvalue(res, 0, 0)); data/tinyows-1.1.1/src/wfs/wfs_request.c:191: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(o->request->version, o->wfs_default_version, sizeof(ows_version)); data/tinyows-1.1.1/src/wfs/wfs_request.c:572:8: [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). mf = atoi(b->buf); data/tinyows-1.1.1/src/wfs/wfs_transaction.c:57:27: [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). wr->delete_results += atoi(cmd_status->buf); data/tinyows-1.1.1/src/wfs/wfs_transaction.c:62:27: [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). wr->update_results += atoi(cmd_status->buf); data/tinyows-1.1.1/src/wfs/wfs_transaction.c:474:53: [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). if (PQresultStatus(res) != PGRES_TUPLES_OK || atoi((char *) PQgetvalue(res, 0, 0)) != 0) data/tinyows-1.1.1/src/fe/fe_comparison_ops.c:190: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((char *) escape)) pg_string = buffer_replace(pg_string, (char *) escape, "\\\\"); data/tinyows-1.1.1/src/fe/fe_comparison_ops.c:191: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((char *) wildcard)) pg_string = buffer_replace(pg_string, (char *) wildcard, "%"); data/tinyows-1.1.1/src/fe/fe_comparison_ops.c:192: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((char *) singlechar)) pg_string = buffer_replace(pg_string, (char *) singlechar, "_"); data/tinyows-1.1.1/src/mapfile/mapfile.c:1079:50: [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 ((fpath[0] == '/') || (fpath[0] == '\\') || (strlen(fpath) && (fpath[1] == ':'))) data/tinyows-1.1.1/src/mapfile/mapfile.c:1778:14: [1] (buffer) getc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ data/tinyows-1.1.1/src/mapfile/mapfile.c:3279: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). return yy_scan_bytes(yystr,strlen(yystr) ); data/tinyows-1.1.1/src/ows/ows.c:382:33: [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 (!o->exit && (!query || !strlen(query))) { data/tinyows-1.1.1/src/ows/ows_psql.c:66: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(PQresultErrorMessage(res))) data/tinyows-1.1.1/src/ows/ows_psql.c:634:36: [1] (buffer) fgetc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). sprintf(seed,"%s%03d", seed, fgetc(fp)); data/tinyows-1.1.1/src/ows/ows_psql.c:836:28: [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). content_escaped = malloc(strlen(content) * 2 + 1); data/tinyows-1.1.1/src/ows/ows_psql.c:837:55: [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). PQescapeStringConn(o->pg, content_escaped, content, strlen(content), &error); data/tinyows-1.1.1/src/ows/ows_storage.c:272: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). (PQntuples(res) == 1 && strlen((char *) PQgetvalue(res, 0, 0)) > 0) ) { data/tinyows-1.1.1/src/ows/ows_storage.c:304:32: [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 (PQntuples(res) == 1 && strlen((char *) PQgetvalue(res, 0, 0)) > 0) { data/tinyows-1.1.1/src/struct/alist.c:124:13: [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). for (ks = strlen(key), an = al->first ; an ; an = an->next) data/tinyows-1.1.1/src/struct/alist.c:146:13: [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). for (ks = strlen(key), an = al->first ; an ; an = an->next) { data/tinyows-1.1.1/src/struct/array.c:113:13: [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). for (ks = strlen(key), an = a->first ; an ; an = an->next) data/tinyows-1.1.1/src/struct/array.c:133:13: [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). for (vs = strlen(value), an = a->first ; an ; an = an->next) data/tinyows-1.1.1/src/struct/array.c:155:13: [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). for (ks = strlen(key), an = a->first ; an ; an = an->next) { data/tinyows-1.1.1/src/struct/array.c:178:13: [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). for (vs = strlen(value), an = a->first ; an ; an = an->next) { data/tinyows-1.1.1/src/struct/buffer.c:145:14: [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). res->use = strlen(res->buf); data/tinyows-1.1.1/src/struct/buffer.c:192:14: [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). res->use = strlen(res->buf); data/tinyows-1.1.1/src/struct/buffer.c:242:12: [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). for (i = strlen(str); i != 0; i--) data/tinyows-1.1.1/src/struct/buffer.c:255:8: [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(str) + buf->use) >= buf->size) data/tinyows-1.1.1/src/struct/buffer.c:256:13: [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). while ((strlen(str) + buf->use) >= buf->size) data/tinyows-1.1.1/src/struct/buffer.c:260: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). buf->use = buf->use + strlen(str); data/tinyows-1.1.1/src/struct/buffer.c:272: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). assert(n <= strlen(str)); data/tinyows-1.1.1/src/struct/buffer.c:278:3: [1] (buffer) strncat: Easily used incorrectly (e.g., incorrectly computing the correct maximum size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, snprintf, or automatically resizing strings. strncat(buf->buf, str, n); data/tinyows-1.1.1/src/struct/buffer.c:293: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). if (buf->use != strlen(str)) return false; data/tinyows-1.1.1/src/struct/buffer.c:333: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). if (buf->use != strlen(str)) return false; data/tinyows-1.1.1/src/struct/buffer.c:425:14: [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). length = strlen(pos); data/tinyows-1.1.1/src/struct/buffer.c:433:44: [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). buffer_shift(rest, buf->use - length + strlen(before)); data/tinyows-1.1.1/src/struct/cgi_request.c:452: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). xmldoc = xmlParseMemory(query, strlen(query)); data/tinyows-1.1.1/src/struct/cgi_request.c:500: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). buffer_shift(typename, strlen((char *) n->nsDef->prefix)); data/tinyows-1.1.1/src/wfs/wfs_get_feature.c:134: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(value) == 0) return; /* Don't display empty property */ data/tinyows-1.1.1/src/wfs/wfs_transaction.c:293:32: [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). buffer_shift(typename, strlen((char *) n->nsDef->prefix)); ANALYSIS SUMMARY: Hits = 117 Lines analyzed = 18822 in approximately 0.56 seconds (33408 lines/second) Physical Source Lines of Code (SLOC) = 12637 Hits@level = [0] 793 [1] 35 [2] 57 [3] 23 [4] 2 [5] 0 Hits@level+ = [0+] 910 [1+] 117 [2+] 82 [3+] 25 [4+] 2 [5+] 0 Hits/KSLOC@level+ = [0+] 72.0108 [1+] 9.25853 [2+] 6.48888 [3+] 1.97832 [4+] 0.158265 [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.