├── .all-contributorsrc ├── .github ├── FUNDING.yml └── workflows │ ├── FUNDING.yml │ ├── greet.yml │ └── test.yml ├── .whitesource ├── CppCheckReport.txt ├── Dockerfile ├── LICENSE ├── README.md ├── __tests__ ├── client │ └── client.c ├── exclude │ └── perfect_square.c ├── fibonacci.c ├── server │ └── server.c └── test.c ├── action.yml ├── cppcheck_report.txt ├── report.txt └── src └── entrypoint.py /.all-contributorsrc: -------------------------------------------------------------------------------- 1 | { 2 | "files": [ 3 | "README.md" 4 | ], 5 | "imageSize": 100, 6 | "commit": false, 7 | "contributors": [ 8 | { 9 | "login": "BaderEddineOuaich", 10 | "name": "Bader", 11 | "avatar_url": "https://avatars2.githubusercontent.com/u/49657842?v=4", 12 | "profile": "http://badereddineouaich.herokuapp.com", 13 | "contributions": [ 14 | "test" 15 | ] 16 | }, 17 | { 18 | "login": "sthagen", 19 | "name": "Stefan Hagen", 20 | "avatar_url": "https://avatars1.githubusercontent.com/u/450800?v=4", 21 | "profile": "https://stefan-hagen.website", 22 | "contributions": [ 23 | "infra", 24 | "test", 25 | "code" 26 | ] 27 | } 28 | ], 29 | "contributorsPerLine": 7, 30 | "projectName": "cppcheck-action", 31 | "projectOwner": "deep5050", 32 | "repoType": "github", 33 | "repoHost": "https://github.com", 34 | "skipCi": true 35 | } 36 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: deep5050 4 | patreon: # Replace with a single Patreon username 5 | open_collective: # Replace with a single Open Collective username 6 | ko_fi: # Replace with a single Ko-fi username 7 | tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel 8 | community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry 9 | liberapay: # Replace with a single Liberapay username 10 | issuehunt: # Replace with a single IssueHunt username 11 | otechie: # Replace with a single Otechie username 12 | lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry 13 | custom: "https://www.paypal.com/paypalme/deep5050" 14 | -------------------------------------------------------------------------------- /.github/workflows/FUNDING.yml: -------------------------------------------------------------------------------- 1 | github: deep5050 2 | custom: ["https://www.paypal.com/paypalme/deep5050"] 3 | -------------------------------------------------------------------------------- /.github/workflows/greet.yml: -------------------------------------------------------------------------------- 1 | name: "Greet With A Random Meme" 2 | on: 3 | issues: 4 | types: [opened, reopened] 5 | pull_request_target: 6 | types: [opened, reopened] 7 | 8 | 9 | jobs: 10 | test: 11 | name: setup environment 12 | runs-on: ubuntu-latest 13 | steps: 14 | - name: memes on isssues 15 | uses: deep5050/memes-on-issues-action@main 16 | with: 17 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 18 | -------------------------------------------------------------------------------- /.github/workflows/test.yml: -------------------------------------------------------------------------------- 1 | name: cppcheck-action-other_options-test 2 | 3 | on: 4 | push: 5 | branches: [ main ] 6 | pull_request: 7 | branches: [ main ] 8 | 9 | jobs: 10 | build: 11 | name: cppcheck 12 | runs-on: ubuntu-latest 13 | steps: 14 | - uses: actions/checkout@v2 15 | 16 | # CppCheck analysis task 17 | - name: cppcheck 18 | uses: ./ 19 | with: 20 | github_token: ${{ secrets.GITHUB_TOKEN }} 21 | check_library: disable 22 | skip_preprocessor: disable 23 | enable: all #performance,portability,warning 24 | exclude_check: ./__tests__/exclude/ 25 | inconclusive: disable 26 | inline_suppression: disable 27 | force_language: c 28 | force: enable 29 | max_ctu_depth: 12 30 | platform: disable 31 | #std: c11 32 | output_file: ./CppCheckReport.txt 33 | other_options: --bug-hunting --verbose --std=c11 34 | 35 | # Report generating task 36 | - name: publish report 37 | uses: mikeal/publish-to-github-action@master 38 | env: 39 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 40 | BRANCH_NAME: 'main' # your branch name goes here 41 | -------------------------------------------------------------------------------- /.whitesource: -------------------------------------------------------------------------------- 1 | { 2 | "checkRunSettings": { 3 | "vulnerableCheckRunConclusionLevel": "failure" 4 | }, 5 | "issueSettings": { 6 | "minSeverityLevel": "LOW" 7 | } 8 | } -------------------------------------------------------------------------------- /CppCheckReport.txt: -------------------------------------------------------------------------------- 1 | __tests__/client/client.c:58:11: error: Buffer read/write, when calling 'memset' it cannot be determined that 1st argument is not overflowed [bughuntingBufferOverflow] 2 | memset(name, '\0', MAX_USERNAME_LEN); 3 | ^ 4 | __tests__/client/client.c:61:12: error: Buffer read/write, when calling 'strncpy' it cannot be determined that 1st argument is not overflowed [bughuntingBufferOverflow] 5 | strncpy(name, p_args->name, strlen(p_args->name) + 1); 6 | ^ 7 | __tests__/client/client.c:65:15: error: Buffer read/write, when calling 'memset' it cannot be determined that 1st argument is not overflowed [bughuntingBufferOverflow] 8 | memset(rcvd_msg, '\0', MAX_MSG_LEN); 9 | ^ 10 | __tests__/client/client.c:96:11: error: Buffer read/write, when calling 'memset' it cannot be determined that 1st argument is not overflowed [bughuntingBufferOverflow] 11 | memset(&server_addr, 0, sizeof(server_addr)); 12 | ^ 13 | __tests__/client/client.c:97:11: error: Buffer read/write, when calling 'memset' it cannot be determined that 1st argument is not overflowed [bughuntingBufferOverflow] 14 | memset(server_ip, '\0', sizeof(server_ip)); 15 | ^ 16 | __tests__/client/client.c:99:11: error: Buffer read/write, when calling 'memset' it cannot be determined that 1st argument is not overflowed [bughuntingBufferOverflow] 17 | memset(name, '\0', sizeof(name)); 18 | ^ 19 | __tests__/client/client.c:100:11: error: Buffer read/write, when calling 'memset' it cannot be determined that 1st argument is not overflowed [bughuntingBufferOverflow] 20 | memset(buff, '\0', sizeof(buff)); 21 | ^ 22 | __tests__/client/client.c:102:32: error: Cannot determine that 'argv[0]' is initialized (you can use 'const' to say data must be initialized) [bughuntingUninitNonConstArg] 23 | while ((opt = getopt(argc, argv, "-a:p:D:n:")) != -1) 24 | ^ 25 | __tests__/client/client.c:162:15: error: Buffer read/write, when calling 'strcpy' it cannot be determined that 1st argument is not overflowed [bughuntingBufferOverflow] 26 | strcpy(server_ip, "0.0.0.0"); 27 | ^ 28 | __tests__/client/client.c:233:12: error: Buffer read/write, when calling 'strncpy' it cannot be determined that 1st argument is not overflowed [bughuntingBufferOverflow] 29 | strncpy(thread_args.name, name, strlen(name)); 30 | ^ 31 | __tests__/client/client.c:223:31: error: Cannot determine that 'greetings_from_server[0]' is initialized [bughuntingUninit] 32 | LOG(_LOG_INFO_, "%s", greetings_from_server); 33 | ^ 34 | __tests__/server/server.c:32:54: error: Array index out of bounds, cannot determine that i is less than 20 [bughuntingArrayIndexOutOfBounds] 35 | int return_val = pthread_cancel(threads_pool[i]); 36 | ^ 37 | __tests__/server/server.c:32:54: error: Array index out of bounds, cannot determine that i is not negative [bughuntingArrayIndexNegative] 38 | int return_val = pthread_cancel(threads_pool[i]); 39 | ^ 40 | __tests__/server/server.c:32:54: error: Array index out of bounds, cannot determine that i is less than 20 [bughuntingArrayIndexOutOfBounds] 41 | int return_val = pthread_cancel(threads_pool[i]); 42 | ^ 43 | __tests__/server/server.c:45:21: note: Calling kill_all_threads 44 | kill_all_threads(); 45 | ^ 46 | __tests__/server/server.c:32:54: note: Array index out of bounds, cannot determine that i is less than 20 47 | int return_val = pthread_cancel(threads_pool[i]); 48 | ^ 49 | __tests__/server/server.c:32:54: error: Array index out of bounds, cannot determine that i is not negative [bughuntingArrayIndexNegative] 50 | int return_val = pthread_cancel(threads_pool[i]); 51 | ^ 52 | __tests__/server/server.c:45:21: note: Calling kill_all_threads 53 | kill_all_threads(); 54 | ^ 55 | __tests__/server/server.c:32:54: note: Array index out of bounds, cannot determine that i is not negative 56 | int return_val = pthread_cancel(threads_pool[i]); 57 | ^ 58 | __tests__/server/server.c:62:32: error: Cannot determine that 'argv[0]' is initialized (you can use 'const' to say data must be initialized) [bughuntingUninitNonConstArg] 59 | while ((opt = getopt(argc, argv, "-p:b:D:")) != -1) 60 | ^ 61 | __tests__/server/server.c:126:11: error: Buffer read/write, when calling 'memset' it cannot be determined that 1st argument is not overflowed [bughuntingBufferOverflow] 62 | memset(&thread_args, 0, sizeof(thread_args)); 63 | ^ 64 | __tests__/server/server.c:132:11: error: Buffer read/write, when calling 'memset' it cannot be determined that 1st argument is not overflowed [bughuntingBufferOverflow] 65 | memset(&server_addr, 0, sizeof(server_addr)); 66 | ^ 67 | __tests__/server/server.c:133:11: error: Buffer read/write, when calling 'memset' it cannot be determined that 1st argument is not overflowed [bughuntingBufferOverflow] 68 | memset(&client_addr, 0, sizeof(client_addr)); 69 | ^ 70 | __tests__/server/server.c:148:14: error: Cannot determine that 'results' is initialized [bughuntingUninit] 71 | for (p = results; p != NULL; p = p->ai_next) 72 | ^ 73 | __tests__/server/server.c:148:12: error: Cannot determine that 'p=results' is initialized [bughuntingUninit] 74 | for (p = results; p != NULL; p = p->ai_next) 75 | ^ 76 | __tests__/server/server.c:148:23: error: Cannot determine that 'p' is initialized [bughuntingUninit] 77 | for (p = results; p != NULL; p = p->ai_next) 78 | ^ 79 | __tests__/server/server.c:84:19: error: Buffer read/write, when calling 'memset' it cannot be determined that 1st argument is not overflowed [bughuntingBufferOverflow] 80 | memset(temp, '\0', sizeof(temp)); 81 | ^ 82 | __tests__/server/server.c:85:20: error: Buffer read/write, when calling 'strncpy' it cannot be determined that 1st argument is not overflowed [bughuntingBufferOverflow] 83 | strncpy(temp, optarg, 4); 84 | ^ 85 | __tests__/server/server.c:174:45: error: Cannot determine that 'addr' is initialized [bughuntingUninit] 86 | inet_ntop(p->ai_family, p->ai_addr, addr, sizeof(addr)); 87 | ^ 88 | __tests__/server/server.c:178:18: error: Cannot determine that 'results' is initialized [bughuntingUninit] 89 | freeaddrinfo(results); 90 | ^ 91 | __tests__/server/server.c:191:39: error: Cannot determine that 'backlog' is initialized [bughuntingUninit] 92 | listen_status = listen(server_fd, backlog); 93 | ^ 94 | __tests__/server/server.c:199:66: error: Cannot determine that 'addr' is initialized [bughuntingUninit] 95 | LOG(_LOG_INFO_, "UP and LISTENING on %s:%s with BACKLOG %d", addr, port, backlog); 96 | ^ 97 | __tests__/server/server.c:199:72: error: Cannot determine that 'port' is initialized [bughuntingUninit] 98 | LOG(_LOG_INFO_, "UP and LISTENING on %s:%s with BACKLOG %d", addr, port, backlog); 99 | ^ 100 | __tests__/server/server.c:199:78: error: Cannot determine that 'backlog' is initialized [bughuntingUninit] 101 | LOG(_LOG_INFO_, "UP and LISTENING on %s:%s with BACKLOG %d", addr, port, backlog); 102 | ^ 103 | __tests__/server/server.c:210:73: error: Cannot determine that 'addr' is initialized [bughuntingUninit] 104 | inet_ntop(client_addr.sin_family, &client_addr.sin_addr.s_addr, addr, sizeof(addr)); 105 | ^ 106 | __tests__/server/server.c:212:59: error: Cannot determine that 'client_addr' is initialized [bughuntingUninit] 107 | client_fd = accept(server_fd, (struct sockaddr *)&client_addr, &client_addr_size); 108 | ^ 109 | __tests__/server/server.c:220:65: error: Cannot determine that 'addr' is initialized [bughuntingUninit] 110 | LOG(_LOG_INFO_, "NEW CLIENT: ID(%d): %s:%d", client_fd, addr, ntohs(client_addr.sin_port)); 111 | ^ 112 | __tests__/server/server.c:228:29: error: Cannot determine that 't_id' is initialized [bughuntingUninit] 113 | if (pthread_create(&t_id, NULL, service_clients, (void *)&thread_args) != 0) 114 | ^ 115 | __tests__/server/server.c:228:67: error: Cannot determine that 'thread_args' is initialized [bughuntingUninit] 116 | if (pthread_create(&t_id, NULL, service_clients, (void *)&thread_args) != 0) 117 | ^ 118 | __tests__/server/server.c:230:64: error: Cannot determine that 't_id' is initialized [bughuntingUninit] 119 | LOG(_LOG_ERR_, "couldn't create the Thread %ld\n", t_id); 120 | ^ 121 | __tests__/server/server.c:236:76: error: Cannot determine that 't_id' is initialized [bughuntingUninit] 122 | LOG(_LOG_INFO_, "New thread created: %ld to service client ID %d", t_id, client_fd); 123 | ^ 124 | __tests__/server/server.c:237:24: error: Cannot determine that 't_id' is initialized [bughuntingUninit] 125 | pthread_detach(t_id); 126 | ^ 127 | __tests__/server/server.c:238:40: error: Cannot determine that 't_id' is initialized [bughuntingUninit] 128 | threads_pool[++thread_count] = t_id; 129 | ^ 130 | __tests__/test.c:26:17: error: There is function call, cannot determine that 1st argument is initialized. [bughuntingUninitArg] 131 | str = asctime(local); 132 | ^ 133 | __tests__/test.c:29:20: error: There is function call, cannot determine that 1st argument is initialized. [bughuntingUninitArg] 134 | int len = strlen(str) + 1; 135 | ^ 136 | __tests__/test.c:34:41: error: There is function call, cannot determine that 3rd argument value is valid. Bad value: less than 0 [bughuntingInvalidArgValue] 137 | strncpy(&str[i], &str[i + 1], len - i); 138 | ^ 139 | __tests__/test.c:34:14: error: Buffer read/write, when calling 'strncpy' it cannot be determined that 1st argument is not overflowed [bughuntingBufferOverflow] 140 | strncpy(&str[i], &str[i + 1], len - i); 141 | ^ 142 | __tests__/test.c:26:17: error: There is function call, cannot determine that 1st argument is initialized. [bughuntingUninitArg] 143 | str = asctime(local); 144 | ^ 145 | __tests__/test.c:136:45: note: Calling timestamp 146 | printf("\n[%s] SERVER CLOSED\n", timestamp()); 147 | ^ 148 | __tests__/test.c:26:17: note: There is function call, cannot determine that 1st argument is initialized. 149 | str = asctime(local); 150 | ^ 151 | __tests__/test.c:29:20: error: There is function call, cannot determine that 1st argument is initialized. [bughuntingUninitArg] 152 | int len = strlen(str) + 1; 153 | ^ 154 | __tests__/test.c:136:45: note: Calling timestamp 155 | printf("\n[%s] SERVER CLOSED\n", timestamp()); 156 | ^ 157 | __tests__/test.c:29:20: note: There is function call, cannot determine that 1st argument is initialized. 158 | int len = strlen(str) + 1; 159 | ^ 160 | __tests__/test.c:34:41: error: There is function call, cannot determine that 3rd argument value is valid. Bad value: less than 0 [bughuntingInvalidArgValue] 161 | strncpy(&str[i], &str[i + 1], len - i); 162 | ^ 163 | __tests__/test.c:136:45: note: Calling timestamp 164 | printf("\n[%s] SERVER CLOSED\n", timestamp()); 165 | ^ 166 | __tests__/test.c:34:41: note: There is function call, cannot determine that 3rd argument value is valid. Bad value: less than 0 167 | strncpy(&str[i], &str[i + 1], len - i); 168 | ^ 169 | __tests__/test.c:34:14: error: Buffer read/write, when calling 'strncpy' it cannot be determined that 1st argument is not overflowed [bughuntingBufferOverflow] 170 | strncpy(&str[i], &str[i + 1], len - i); 171 | ^ 172 | __tests__/test.c:136:45: note: Calling timestamp 173 | printf("\n[%s] SERVER CLOSED\n", timestamp()); 174 | ^ 175 | __tests__/test.c:34:14: note: Buffer read/write, when calling 'strncpy' it cannot be determined that 1st argument is not overflowed 176 | strncpy(&str[i], &str[i + 1], len - i); 177 | ^ 178 | __tests__/test.c:148:11: error: Cannot determine that 'argv[1]' is initialized (you can use 'const' to say data must be initialized) [bughuntingUninitNonConstArg] 179 | if (argv[1] == "" || argv[1] == NULL) { 180 | ^ 181 | __tests__/test.c:153:11: error: Cannot determine that 'argv[2]' is initialized (you can use 'const' to say data must be initialized) [bughuntingUninitNonConstArg] 182 | if (argv[2] == "" || argv[2] == NULL) { 183 | ^ 184 | __tests__/test.c:158:24: error: Cannot determine that 'argv[2]' is initialized (you can use 'const' to say data must be initialized) [bughuntingUninitNonConstArg] 185 | backlog = strtol(argv[2], &strptr, 10); 186 | ^ 187 | __tests__/test.c:172:9: error: Buffer read/write, when calling 'memset' it cannot be determined that 1st argument is not overflowed [bughuntingBufferOverflow] 188 | memset(&server_addr, 0, sizeof(server_addr)); 189 | ^ 190 | __tests__/test.c:173:9: error: Buffer read/write, when calling 'memset' it cannot be determined that 1st argument is not overflowed [bughuntingBufferOverflow] 191 | memset(&client_addr, 0, sizeof(client_addr)); 192 | ^ 193 | __tests__/test.c:194:44: error: Cannot determine that 'argv[1]' is initialized (you can use 'const' to say data must be initialized) [bughuntingUninitNonConstArg] 194 | if ((addr_status = getaddrinfo(NULL, argv[1], &server_addr, &results)) != 0) { 195 | ^ 196 | __tests__/test.c:26:17: error: There is function call, cannot determine that 1st argument is initialized. [bughuntingUninitArg] 197 | str = asctime(local); 198 | ^ 199 | __tests__/test.c:195:63: note: Calling timestamp 200 | printf("[%s] SERVER: ERROR getaddrinfo(): %s\n", timestamp(), 201 | ^ 202 | __tests__/test.c:26:17: note: There is function call, cannot determine that 1st argument is initialized. 203 | str = asctime(local); 204 | ^ 205 | __tests__/test.c:29:20: error: There is function call, cannot determine that 1st argument is initialized. [bughuntingUninitArg] 206 | int len = strlen(str) + 1; 207 | ^ 208 | __tests__/test.c:195:63: note: Calling timestamp 209 | printf("[%s] SERVER: ERROR getaddrinfo(): %s\n", timestamp(), 210 | ^ 211 | __tests__/test.c:29:20: note: There is function call, cannot determine that 1st argument is initialized. 212 | int len = strlen(str) + 1; 213 | ^ 214 | __tests__/test.c:34:41: error: There is function call, cannot determine that 3rd argument value is valid. Bad value: less than 0 [bughuntingInvalidArgValue] 215 | strncpy(&str[i], &str[i + 1], len - i); 216 | ^ 217 | __tests__/test.c:195:63: note: Calling timestamp 218 | printf("[%s] SERVER: ERROR getaddrinfo(): %s\n", timestamp(), 219 | ^ 220 | __tests__/test.c:34:41: note: There is function call, cannot determine that 3rd argument value is valid. Bad value: less than 0 221 | strncpy(&str[i], &str[i + 1], len - i); 222 | ^ 223 | __tests__/test.c:34:14: error: Buffer read/write, when calling 'strncpy' it cannot be determined that 1st argument is not overflowed [bughuntingBufferOverflow] 224 | strncpy(&str[i], &str[i + 1], len - i); 225 | ^ 226 | __tests__/test.c:195:63: note: Calling timestamp 227 | printf("[%s] SERVER: ERROR getaddrinfo(): %s\n", timestamp(), 228 | ^ 229 | __tests__/test.c:34:14: note: Buffer read/write, when calling 'strncpy' it cannot be determined that 1st argument is not overflowed 230 | strncpy(&str[i], &str[i + 1], len - i); 231 | ^ 232 | __tests__/test.c:201:12: error: Cannot determine that 'results' is initialized [bughuntingUninit] 233 | for (p = results; p != NULL; p = p->ai_next) { 234 | ^ 235 | __tests__/test.c:201:10: error: Cannot determine that 'p=results' is initialized [bughuntingUninit] 236 | for (p = results; p != NULL; p = p->ai_next) { 237 | ^ 238 | __tests__/test.c:201:21: error: Cannot determine that 'p' is initialized [bughuntingUninit] 239 | for (p = results; p != NULL; p = p->ai_next) { 240 | ^ 241 | __tests__/test.c:203:41: error: Cannot determine that 'addr[0]' is initialized [bughuntingUninit] 242 | inet_ntop(p->ai_family, p->ai_addr, addr, sizeof(addr)); 243 | ^ 244 | __tests__/test.c:26:17: error: There is function call, cannot determine that 1st argument is initialized. [bughuntingUninitArg] 245 | str = asctime(local); 246 | ^ 247 | __tests__/test.c:204:60: note: Calling timestamp 248 | printf("[%s] SERVER: Trying to build on: %s", timestamp(), addr); 249 | ^ 250 | __tests__/test.c:26:17: note: There is function call, cannot determine that 1st argument is initialized. 251 | str = asctime(local); 252 | ^ 253 | __tests__/test.c:29:20: error: There is function call, cannot determine that 1st argument is initialized. [bughuntingUninitArg] 254 | int len = strlen(str) + 1; 255 | ^ 256 | __tests__/test.c:204:60: note: Calling timestamp 257 | printf("[%s] SERVER: Trying to build on: %s", timestamp(), addr); 258 | ^ 259 | __tests__/test.c:29:20: note: There is function call, cannot determine that 1st argument is initialized. 260 | int len = strlen(str) + 1; 261 | ^ 262 | __tests__/test.c:34:41: error: There is function call, cannot determine that 3rd argument value is valid. Bad value: less than 0 [bughuntingInvalidArgValue] 263 | strncpy(&str[i], &str[i + 1], len - i); 264 | ^ 265 | __tests__/test.c:204:60: note: Calling timestamp 266 | printf("[%s] SERVER: Trying to build on: %s", timestamp(), addr); 267 | ^ 268 | __tests__/test.c:34:41: note: There is function call, cannot determine that 3rd argument value is valid. Bad value: less than 0 269 | strncpy(&str[i], &str[i + 1], len - i); 270 | ^ 271 | __tests__/test.c:34:14: error: Buffer read/write, when calling 'strncpy' it cannot be determined that 1st argument is not overflowed [bughuntingBufferOverflow] 272 | strncpy(&str[i], &str[i + 1], len - i); 273 | ^ 274 | __tests__/test.c:204:60: note: Calling timestamp 275 | printf("[%s] SERVER: Trying to build on: %s", timestamp(), addr); 276 | ^ 277 | __tests__/test.c:34:14: note: Buffer read/write, when calling 'strncpy' it cannot be determined that 1st argument is not overflowed 278 | strncpy(&str[i], &str[i + 1], len - i); 279 | ^ 280 | __tests__/test.c:231:16: error: Cannot determine that 'results' is initialized [bughuntingUninit] 281 | freeaddrinfo(results); 282 | ^ 283 | __tests__/test.c:26:17: error: There is function call, cannot determine that 1st argument is initialized. [bughuntingUninitArg] 284 | str = asctime(local); 285 | ^ 286 | __tests__/test.c:250:19: note: Calling timestamp 287 | timestamp(), addr, argv[1], backlog); 288 | ^ 289 | __tests__/test.c:26:17: note: There is function call, cannot determine that 1st argument is initialized. 290 | str = asctime(local); 291 | ^ 292 | __tests__/test.c:29:20: error: There is function call, cannot determine that 1st argument is initialized. [bughuntingUninitArg] 293 | int len = strlen(str) + 1; 294 | ^ 295 | __tests__/test.c:250:19: note: Calling timestamp 296 | timestamp(), addr, argv[1], backlog); 297 | ^ 298 | __tests__/test.c:29:20: note: There is function call, cannot determine that 1st argument is initialized. 299 | int len = strlen(str) + 1; 300 | ^ 301 | __tests__/test.c:34:41: error: There is function call, cannot determine that 3rd argument value is valid. Bad value: less than 0 [bughuntingInvalidArgValue] 302 | strncpy(&str[i], &str[i + 1], len - i); 303 | ^ 304 | __tests__/test.c:250:19: note: Calling timestamp 305 | timestamp(), addr, argv[1], backlog); 306 | ^ 307 | __tests__/test.c:34:41: note: There is function call, cannot determine that 3rd argument value is valid. Bad value: less than 0 308 | strncpy(&str[i], &str[i + 1], len - i); 309 | ^ 310 | __tests__/test.c:34:14: error: Buffer read/write, when calling 'strncpy' it cannot be determined that 1st argument is not overflowed [bughuntingBufferOverflow] 311 | strncpy(&str[i], &str[i + 1], len - i); 312 | ^ 313 | __tests__/test.c:250:19: note: Calling timestamp 314 | timestamp(), addr, argv[1], backlog); 315 | ^ 316 | __tests__/test.c:34:14: note: Buffer read/write, when calling 'strncpy' it cannot be determined that 1st argument is not overflowed 317 | strncpy(&str[i], &str[i + 1], len - i); 318 | ^ 319 | __tests__/test.c:250:33: error: Cannot determine that 'argv[1]' is initialized (you can use 'const' to say data must be initialized) [bughuntingUninitNonConstArg] 320 | timestamp(), addr, argv[1], backlog); 321 | ^ 322 | __tests__/test.c:26:17: error: There is function call, cannot determine that 1st argument is initialized. [bughuntingUninitArg] 323 | str = asctime(local); 324 | ^ 325 | __tests__/test.c:279:64: note: Calling timestamp 326 | printf("[%s] SERVER: NEW CLIENT ID(%d): %s:%d\n", timestamp(), 327 | ^ 328 | __tests__/test.c:26:17: note: There is function call, cannot determine that 1st argument is initialized. 329 | str = asctime(local); 330 | ^ 331 | __tests__/test.c:29:20: error: There is function call, cannot determine that 1st argument is initialized. [bughuntingUninitArg] 332 | int len = strlen(str) + 1; 333 | ^ 334 | __tests__/test.c:279:64: note: Calling timestamp 335 | printf("[%s] SERVER: NEW CLIENT ID(%d): %s:%d\n", timestamp(), 336 | ^ 337 | __tests__/test.c:29:20: note: There is function call, cannot determine that 1st argument is initialized. 338 | int len = strlen(str) + 1; 339 | ^ 340 | __tests__/test.c:34:41: error: There is function call, cannot determine that 3rd argument value is valid. Bad value: less than 0 [bughuntingInvalidArgValue] 341 | strncpy(&str[i], &str[i + 1], len - i); 342 | ^ 343 | __tests__/test.c:279:64: note: Calling timestamp 344 | printf("[%s] SERVER: NEW CLIENT ID(%d): %s:%d\n", timestamp(), 345 | ^ 346 | __tests__/test.c:34:41: note: There is function call, cannot determine that 3rd argument value is valid. Bad value: less than 0 347 | strncpy(&str[i], &str[i + 1], len - i); 348 | ^ 349 | __tests__/test.c:34:14: error: Buffer read/write, when calling 'strncpy' it cannot be determined that 1st argument is not overflowed [bughuntingBufferOverflow] 350 | strncpy(&str[i], &str[i + 1], len - i); 351 | ^ 352 | __tests__/test.c:279:64: note: Calling timestamp 353 | printf("[%s] SERVER: NEW CLIENT ID(%d): %s:%d\n", timestamp(), 354 | ^ 355 | __tests__/test.c:34:14: note: Buffer read/write, when calling 'strncpy' it cannot be determined that 1st argument is not overflowed 356 | strncpy(&str[i], &str[i + 1], len - i); 357 | ^ 358 | __tests__/test.c:26:17: error: There is function call, cannot determine that 1st argument is initialized. [bughuntingUninitArg] 359 | str = asctime(local); 360 | ^ 361 | __tests__/test.c:287:75: note: Calling timestamp 362 | printf("[%s] SERVER: Connection lost with client(%d)\n", timestamp(), 363 | ^ 364 | __tests__/test.c:26:17: note: There is function call, cannot determine that 1st argument is initialized. 365 | str = asctime(local); 366 | ^ 367 | __tests__/test.c:29:20: error: There is function call, cannot determine that 1st argument is initialized. [bughuntingUninitArg] 368 | int len = strlen(str) + 1; 369 | ^ 370 | __tests__/test.c:287:75: note: Calling timestamp 371 | printf("[%s] SERVER: Connection lost with client(%d)\n", timestamp(), 372 | ^ 373 | __tests__/test.c:29:20: note: There is function call, cannot determine that 1st argument is initialized. 374 | int len = strlen(str) + 1; 375 | ^ 376 | __tests__/test.c:34:41: error: There is function call, cannot determine that 3rd argument value is valid. Bad value: less than 0 [bughuntingInvalidArgValue] 377 | strncpy(&str[i], &str[i + 1], len - i); 378 | ^ 379 | __tests__/test.c:287:75: note: Calling timestamp 380 | printf("[%s] SERVER: Connection lost with client(%d)\n", timestamp(), 381 | ^ 382 | __tests__/test.c:34:41: note: There is function call, cannot determine that 3rd argument value is valid. Bad value: less than 0 383 | strncpy(&str[i], &str[i + 1], len - i); 384 | ^ 385 | __tests__/test.c:34:14: error: Buffer read/write, when calling 'strncpy' it cannot be determined that 1st argument is not overflowed [bughuntingBufferOverflow] 386 | strncpy(&str[i], &str[i + 1], len - i); 387 | ^ 388 | __tests__/test.c:287:75: note: Calling timestamp 389 | printf("[%s] SERVER: Connection lost with client(%d)\n", timestamp(), 390 | ^ 391 | __tests__/test.c:34:14: note: Buffer read/write, when calling 'strncpy' it cannot be determined that 1st argument is not overflowed 392 | strncpy(&str[i], &str[i + 1], len - i); 393 | ^ 394 | __tests__/test.c:296:13: error: Cannot determine that 'buff[0]' is initialized [bughuntingUninit] 395 | bzero(buff, max_mssg_len); 396 | ^ 397 | __tests__/test.c:26:17: error: There is function call, cannot determine that 1st argument is initialized. [bughuntingUninitArg] 398 | str = asctime(local); 399 | ^ 400 | __tests__/test.c:303:77: note: Calling timestamp 401 | printf("[%s] SERVER: Connection lost with client(%d)\n", timestamp(), 402 | ^ 403 | __tests__/test.c:26:17: note: There is function call, cannot determine that 1st argument is initialized. 404 | str = asctime(local); 405 | ^ 406 | __tests__/test.c:29:20: error: There is function call, cannot determine that 1st argument is initialized. [bughuntingUninitArg] 407 | int len = strlen(str) + 1; 408 | ^ 409 | __tests__/test.c:303:77: note: Calling timestamp 410 | printf("[%s] SERVER: Connection lost with client(%d)\n", timestamp(), 411 | ^ 412 | __tests__/test.c:29:20: note: There is function call, cannot determine that 1st argument is initialized. 413 | int len = strlen(str) + 1; 414 | ^ 415 | __tests__/test.c:34:41: error: There is function call, cannot determine that 3rd argument value is valid. Bad value: less than 0 [bughuntingInvalidArgValue] 416 | strncpy(&str[i], &str[i + 1], len - i); 417 | ^ 418 | __tests__/test.c:303:77: note: Calling timestamp 419 | printf("[%s] SERVER: Connection lost with client(%d)\n", timestamp(), 420 | ^ 421 | __tests__/test.c:34:41: note: There is function call, cannot determine that 3rd argument value is valid. Bad value: less than 0 422 | strncpy(&str[i], &str[i + 1], len - i); 423 | ^ 424 | __tests__/test.c:34:14: error: Buffer read/write, when calling 'strncpy' it cannot be determined that 1st argument is not overflowed [bughuntingBufferOverflow] 425 | strncpy(&str[i], &str[i + 1], len - i); 426 | ^ 427 | __tests__/test.c:303:77: note: Calling timestamp 428 | printf("[%s] SERVER: Connection lost with client(%d)\n", timestamp(), 429 | ^ 430 | __tests__/test.c:34:14: note: Buffer read/write, when calling 'strncpy' it cannot be determined that 1st argument is not overflowed 431 | strncpy(&str[i], &str[i + 1], len - i); 432 | ^ 433 | __tests__/test.c:26:17: error: There is function call, cannot determine that 1st argument is initialized. [bughuntingUninitArg] 434 | str = asctime(local); 435 | ^ 436 | __tests__/test.c:312:70: note: Calling timestamp 437 | printf("[%s] SERVER: DISCONNECTED: CLIENT(%d)\n", timestamp(), 438 | ^ 439 | __tests__/test.c:26:17: note: There is function call, cannot determine that 1st argument is initialized. 440 | str = asctime(local); 441 | ^ 442 | __tests__/test.c:29:20: error: There is function call, cannot determine that 1st argument is initialized. [bughuntingUninitArg] 443 | int len = strlen(str) + 1; 444 | ^ 445 | __tests__/test.c:312:70: note: Calling timestamp 446 | printf("[%s] SERVER: DISCONNECTED: CLIENT(%d)\n", timestamp(), 447 | ^ 448 | __tests__/test.c:29:20: note: There is function call, cannot determine that 1st argument is initialized. 449 | int len = strlen(str) + 1; 450 | ^ 451 | __tests__/test.c:34:41: error: There is function call, cannot determine that 3rd argument value is valid. Bad value: less than 0 [bughuntingInvalidArgValue] 452 | strncpy(&str[i], &str[i + 1], len - i); 453 | ^ 454 | __tests__/test.c:312:70: note: Calling timestamp 455 | printf("[%s] SERVER: DISCONNECTED: CLIENT(%d)\n", timestamp(), 456 | ^ 457 | __tests__/test.c:34:41: note: There is function call, cannot determine that 3rd argument value is valid. Bad value: less than 0 458 | strncpy(&str[i], &str[i + 1], len - i); 459 | ^ 460 | __tests__/test.c:34:14: error: Buffer read/write, when calling 'strncpy' it cannot be determined that 1st argument is not overflowed [bughuntingBufferOverflow] 461 | strncpy(&str[i], &str[i + 1], len - i); 462 | ^ 463 | __tests__/test.c:312:70: note: Calling timestamp 464 | printf("[%s] SERVER: DISCONNECTED: CLIENT(%d)\n", timestamp(), 465 | ^ 466 | __tests__/test.c:34:14: note: Buffer read/write, when calling 'strncpy' it cannot be determined that 1st argument is not overflowed 467 | strncpy(&str[i], &str[i + 1], len - i); 468 | ^ 469 | __tests__/test.c:26:17: error: There is function call, cannot determine that 1st argument is initialized. [bughuntingUninitArg] 470 | str = asctime(local); 471 | ^ 472 | __tests__/test.c:318:53: note: Calling timestamp 473 | printf("[%s] CLIENT_%d@host:~$%s", timestamp(), client_fd - 3, buff); 474 | ^ 475 | __tests__/test.c:26:17: note: There is function call, cannot determine that 1st argument is initialized. 476 | str = asctime(local); 477 | ^ 478 | __tests__/test.c:29:20: error: There is function call, cannot determine that 1st argument is initialized. [bughuntingUninitArg] 479 | int len = strlen(str) + 1; 480 | ^ 481 | __tests__/test.c:318:53: note: Calling timestamp 482 | printf("[%s] CLIENT_%d@host:~$%s", timestamp(), client_fd - 3, buff); 483 | ^ 484 | __tests__/test.c:29:20: note: There is function call, cannot determine that 1st argument is initialized. 485 | int len = strlen(str) + 1; 486 | ^ 487 | __tests__/test.c:34:41: error: There is function call, cannot determine that 3rd argument value is valid. Bad value: less than 0 [bughuntingInvalidArgValue] 488 | strncpy(&str[i], &str[i + 1], len - i); 489 | ^ 490 | __tests__/test.c:318:53: note: Calling timestamp 491 | printf("[%s] CLIENT_%d@host:~$%s", timestamp(), client_fd - 3, buff); 492 | ^ 493 | __tests__/test.c:34:41: note: There is function call, cannot determine that 3rd argument value is valid. Bad value: less than 0 494 | strncpy(&str[i], &str[i + 1], len - i); 495 | ^ 496 | __tests__/test.c:34:14: error: Buffer read/write, when calling 'strncpy' it cannot be determined that 1st argument is not overflowed [bughuntingBufferOverflow] 497 | strncpy(&str[i], &str[i + 1], len - i); 498 | ^ 499 | __tests__/test.c:318:53: note: Calling timestamp 500 | printf("[%s] CLIENT_%d@host:~$%s", timestamp(), client_fd - 3, buff); 501 | ^ 502 | __tests__/test.c:34:14: note: Buffer read/write, when calling 'strncpy' it cannot be determined that 1st argument is not overflowed 503 | strncpy(&str[i], &str[i + 1], len - i); 504 | ^ 505 | __tests__/test.c:62:50: error: Array index out of bounds, cannot determine that i is less than 20 [bughuntingArrayIndexOutOfBounds] 506 | int return_val = pthread_cancel(threads_pool[i]); 507 | ^ 508 | __tests__/test.c:62:50: error: Array index out of bounds, cannot determine that i is not negative [bughuntingArrayIndexNegative] 509 | int return_val = pthread_cancel(threads_pool[i]); 510 | ^ 511 | __tests__/test.c:26:17: error: There is function call, cannot determine that 1st argument is initialized. [bughuntingUninitArg] 512 | str = asctime(local); 513 | ^ 514 | __tests__/test.c:67:78: note: Calling timestamp 515 | printf("\n[%s] SERVER: %d threads did not shutdown properly\n", timestamp(), 516 | ^ 517 | __tests__/test.c:26:17: note: There is function call, cannot determine that 1st argument is initialized. 518 | str = asctime(local); 519 | ^ 520 | __tests__/test.c:29:20: error: There is function call, cannot determine that 1st argument is initialized. [bughuntingUninitArg] 521 | int len = strlen(str) + 1; 522 | ^ 523 | __tests__/test.c:67:78: note: Calling timestamp 524 | printf("\n[%s] SERVER: %d threads did not shutdown properly\n", timestamp(), 525 | ^ 526 | __tests__/test.c:29:20: note: There is function call, cannot determine that 1st argument is initialized. 527 | int len = strlen(str) + 1; 528 | ^ 529 | __tests__/test.c:34:41: error: There is function call, cannot determine that 3rd argument value is valid. Bad value: less than 0 [bughuntingInvalidArgValue] 530 | strncpy(&str[i], &str[i + 1], len - i); 531 | ^ 532 | __tests__/test.c:67:78: note: Calling timestamp 533 | printf("\n[%s] SERVER: %d threads did not shutdown properly\n", timestamp(), 534 | ^ 535 | __tests__/test.c:34:41: note: There is function call, cannot determine that 3rd argument value is valid. Bad value: less than 0 536 | strncpy(&str[i], &str[i + 1], len - i); 537 | ^ 538 | __tests__/test.c:34:14: error: Buffer read/write, when calling 'strncpy' it cannot be determined that 1st argument is not overflowed [bughuntingBufferOverflow] 539 | strncpy(&str[i], &str[i + 1], len - i); 540 | ^ 541 | __tests__/test.c:67:78: note: Calling timestamp 542 | printf("\n[%s] SERVER: %d threads did not shutdown properly\n", timestamp(), 543 | ^ 544 | __tests__/test.c:34:14: note: Buffer read/write, when calling 'strncpy' it cannot be determined that 1st argument is not overflowed 545 | strncpy(&str[i], &str[i + 1], len - i); 546 | ^ 547 | __tests__/test.c:26:17: error: There is function call, cannot determine that 1st argument is initialized. [bughuntingUninitArg] 548 | str = asctime(local); 549 | ^ 550 | __tests__/test.c:70:65: note: Calling timestamp 551 | printf("\n[%s] All threads exited successfully\n", timestamp()); 552 | ^ 553 | __tests__/test.c:26:17: note: There is function call, cannot determine that 1st argument is initialized. 554 | str = asctime(local); 555 | ^ 556 | __tests__/test.c:29:20: error: There is function call, cannot determine that 1st argument is initialized. [bughuntingUninitArg] 557 | int len = strlen(str) + 1; 558 | ^ 559 | __tests__/test.c:70:65: note: Calling timestamp 560 | printf("\n[%s] All threads exited successfully\n", timestamp()); 561 | ^ 562 | __tests__/test.c:29:20: note: There is function call, cannot determine that 1st argument is initialized. 563 | int len = strlen(str) + 1; 564 | ^ 565 | __tests__/test.c:34:41: error: There is function call, cannot determine that 3rd argument value is valid. Bad value: less than 0 [bughuntingInvalidArgValue] 566 | strncpy(&str[i], &str[i + 1], len - i); 567 | ^ 568 | __tests__/test.c:70:65: note: Calling timestamp 569 | printf("\n[%s] All threads exited successfully\n", timestamp()); 570 | ^ 571 | __tests__/test.c:34:41: note: There is function call, cannot determine that 3rd argument value is valid. Bad value: less than 0 572 | strncpy(&str[i], &str[i + 1], len - i); 573 | ^ 574 | __tests__/test.c:34:14: error: Buffer read/write, when calling 'strncpy' it cannot be determined that 1st argument is not overflowed [bughuntingBufferOverflow] 575 | strncpy(&str[i], &str[i + 1], len - i); 576 | ^ 577 | __tests__/test.c:70:65: note: Calling timestamp 578 | printf("\n[%s] All threads exited successfully\n", timestamp()); 579 | ^ 580 | __tests__/test.c:34:14: note: Buffer read/write, when calling 'strncpy' it cannot be determined that 1st argument is not overflowed 581 | strncpy(&str[i], &str[i + 1], len - i); 582 | ^ 583 | __tests__/test.c:26:17: error: There is function call, cannot determine that 1st argument is initialized. [bughuntingUninitArg] 584 | str = asctime(local); 585 | ^ 586 | __tests__/test.c:85:55: note: Calling timestamp 587 | printf("[%s] SERVER: Inside Thread %ld\n", timestamp(), pthread_self()); 588 | ^ 589 | __tests__/test.c:26:17: note: There is function call, cannot determine that 1st argument is initialized. 590 | str = asctime(local); 591 | ^ 592 | __tests__/test.c:29:20: error: There is function call, cannot determine that 1st argument is initialized. [bughuntingUninitArg] 593 | int len = strlen(str) + 1; 594 | ^ 595 | __tests__/test.c:85:55: note: Calling timestamp 596 | printf("[%s] SERVER: Inside Thread %ld\n", timestamp(), pthread_self()); 597 | ^ 598 | __tests__/test.c:29:20: note: There is function call, cannot determine that 1st argument is initialized. 599 | int len = strlen(str) + 1; 600 | ^ 601 | __tests__/test.c:34:41: error: There is function call, cannot determine that 3rd argument value is valid. Bad value: less than 0 [bughuntingInvalidArgValue] 602 | strncpy(&str[i], &str[i + 1], len - i); 603 | ^ 604 | __tests__/test.c:85:55: note: Calling timestamp 605 | printf("[%s] SERVER: Inside Thread %ld\n", timestamp(), pthread_self()); 606 | ^ 607 | __tests__/test.c:34:41: note: There is function call, cannot determine that 3rd argument value is valid. Bad value: less than 0 608 | strncpy(&str[i], &str[i + 1], len - i); 609 | ^ 610 | __tests__/test.c:34:14: error: Buffer read/write, when calling 'strncpy' it cannot be determined that 1st argument is not overflowed [bughuntingBufferOverflow] 611 | strncpy(&str[i], &str[i + 1], len - i); 612 | ^ 613 | __tests__/test.c:85:55: note: Calling timestamp 614 | printf("[%s] SERVER: Inside Thread %ld\n", timestamp(), pthread_self()); 615 | ^ 616 | __tests__/test.c:34:14: note: Buffer read/write, when calling 'strncpy' it cannot be determined that 1st argument is not overflowed 617 | strncpy(&str[i], &str[i + 1], len - i); 618 | ^ 619 | __tests__/test.c:26:17: error: There is function call, cannot determine that 1st argument is initialized. [bughuntingUninitArg] 620 | str = asctime(local); 621 | ^ 622 | __tests__/test.c:93:71: note: Calling timestamp 623 | printf("[%s] SERVER: Connection lost with client(%d)\n", timestamp(), 624 | ^ 625 | __tests__/test.c:26:17: note: There is function call, cannot determine that 1st argument is initialized. 626 | str = asctime(local); 627 | ^ 628 | __tests__/test.c:29:20: error: There is function call, cannot determine that 1st argument is initialized. [bughuntingUninitArg] 629 | int len = strlen(str) + 1; 630 | ^ 631 | __tests__/test.c:93:71: note: Calling timestamp 632 | printf("[%s] SERVER: Connection lost with client(%d)\n", timestamp(), 633 | ^ 634 | __tests__/test.c:29:20: note: There is function call, cannot determine that 1st argument is initialized. 635 | int len = strlen(str) + 1; 636 | ^ 637 | __tests__/test.c:34:41: error: There is function call, cannot determine that 3rd argument value is valid. Bad value: less than 0 [bughuntingInvalidArgValue] 638 | strncpy(&str[i], &str[i + 1], len - i); 639 | ^ 640 | __tests__/test.c:93:71: note: Calling timestamp 641 | printf("[%s] SERVER: Connection lost with client(%d)\n", timestamp(), 642 | ^ 643 | __tests__/test.c:34:41: note: There is function call, cannot determine that 3rd argument value is valid. Bad value: less than 0 644 | strncpy(&str[i], &str[i + 1], len - i); 645 | ^ 646 | __tests__/test.c:34:14: error: Buffer read/write, when calling 'strncpy' it cannot be determined that 1st argument is not overflowed [bughuntingBufferOverflow] 647 | strncpy(&str[i], &str[i + 1], len - i); 648 | ^ 649 | __tests__/test.c:93:71: note: Calling timestamp 650 | printf("[%s] SERVER: Connection lost with client(%d)\n", timestamp(), 651 | ^ 652 | __tests__/test.c:34:14: note: Buffer read/write, when calling 'strncpy' it cannot be determined that 1st argument is not overflowed 653 | strncpy(&str[i], &str[i + 1], len - i); 654 | ^ 655 | __tests__/test.c:101:9: error: Cannot determine that 'buff[0]' is initialized [bughuntingUninit] 656 | bzero(buff, max_mssg_len); 657 | ^ 658 | __tests__/test.c:26:17: error: There is function call, cannot determine that 1st argument is initialized. [bughuntingUninitArg] 659 | str = asctime(local); 660 | ^ 661 | __tests__/test.c:107:73: note: Calling timestamp 662 | printf("[%s] SERVER: Connection lost with client(%d)\n", timestamp(), 663 | ^ 664 | __tests__/test.c:26:17: note: There is function call, cannot determine that 1st argument is initialized. 665 | str = asctime(local); 666 | ^ 667 | __tests__/test.c:29:20: error: There is function call, cannot determine that 1st argument is initialized. [bughuntingUninitArg] 668 | int len = strlen(str) + 1; 669 | ^ 670 | __tests__/test.c:107:73: note: Calling timestamp 671 | printf("[%s] SERVER: Connection lost with client(%d)\n", timestamp(), 672 | ^ 673 | __tests__/test.c:29:20: note: There is function call, cannot determine that 1st argument is initialized. 674 | int len = strlen(str) + 1; 675 | ^ 676 | __tests__/test.c:34:41: error: There is function call, cannot determine that 3rd argument value is valid. Bad value: less than 0 [bughuntingInvalidArgValue] 677 | strncpy(&str[i], &str[i + 1], len - i); 678 | ^ 679 | __tests__/test.c:107:73: note: Calling timestamp 680 | printf("[%s] SERVER: Connection lost with client(%d)\n", timestamp(), 681 | ^ 682 | __tests__/test.c:34:41: note: There is function call, cannot determine that 3rd argument value is valid. Bad value: less than 0 683 | strncpy(&str[i], &str[i + 1], len - i); 684 | ^ 685 | __tests__/test.c:34:14: error: Buffer read/write, when calling 'strncpy' it cannot be determined that 1st argument is not overflowed [bughuntingBufferOverflow] 686 | strncpy(&str[i], &str[i + 1], len - i); 687 | ^ 688 | __tests__/test.c:107:73: note: Calling timestamp 689 | printf("[%s] SERVER: Connection lost with client(%d)\n", timestamp(), 690 | ^ 691 | __tests__/test.c:34:14: note: Buffer read/write, when calling 'strncpy' it cannot be determined that 1st argument is not overflowed 692 | strncpy(&str[i], &str[i + 1], len - i); 693 | ^ 694 | __tests__/test.c:26:17: error: There is function call, cannot determine that 1st argument is initialized. [bughuntingUninitArg] 695 | str = asctime(local); 696 | ^ 697 | __tests__/test.c:117:58: note: Calling timestamp 698 | printf("[%s] DISCONNECTED: CLIENT(%d)\n", timestamp(), client_fd - 3); 699 | ^ 700 | __tests__/test.c:26:17: note: There is function call, cannot determine that 1st argument is initialized. 701 | str = asctime(local); 702 | ^ 703 | __tests__/test.c:29:20: error: There is function call, cannot determine that 1st argument is initialized. [bughuntingUninitArg] 704 | int len = strlen(str) + 1; 705 | ^ 706 | __tests__/test.c:117:58: note: Calling timestamp 707 | printf("[%s] DISCONNECTED: CLIENT(%d)\n", timestamp(), client_fd - 3); 708 | ^ 709 | __tests__/test.c:29:20: note: There is function call, cannot determine that 1st argument is initialized. 710 | int len = strlen(str) + 1; 711 | ^ 712 | __tests__/test.c:34:41: error: There is function call, cannot determine that 3rd argument value is valid. Bad value: less than 0 [bughuntingInvalidArgValue] 713 | strncpy(&str[i], &str[i + 1], len - i); 714 | ^ 715 | __tests__/test.c:117:58: note: Calling timestamp 716 | printf("[%s] DISCONNECTED: CLIENT(%d)\n", timestamp(), client_fd - 3); 717 | ^ 718 | __tests__/test.c:34:41: note: There is function call, cannot determine that 3rd argument value is valid. Bad value: less than 0 719 | strncpy(&str[i], &str[i + 1], len - i); 720 | ^ 721 | __tests__/test.c:34:14: error: Buffer read/write, when calling 'strncpy' it cannot be determined that 1st argument is not overflowed [bughuntingBufferOverflow] 722 | strncpy(&str[i], &str[i + 1], len - i); 723 | ^ 724 | __tests__/test.c:117:58: note: Calling timestamp 725 | printf("[%s] DISCONNECTED: CLIENT(%d)\n", timestamp(), client_fd - 3); 726 | ^ 727 | __tests__/test.c:34:14: note: Buffer read/write, when calling 'strncpy' it cannot be determined that 1st argument is not overflowed 728 | strncpy(&str[i], &str[i + 1], len - i); 729 | ^ 730 | __tests__/test.c:26:17: error: There is function call, cannot determine that 1st argument is initialized. [bughuntingUninitArg] 731 | str = asctime(local); 732 | ^ 733 | __tests__/test.c:118:65: note: Calling timestamp 734 | printf("[%s] SERVER: Exiting from Thread %ld\n", timestamp(), 735 | ^ 736 | __tests__/test.c:26:17: note: There is function call, cannot determine that 1st argument is initialized. 737 | str = asctime(local); 738 | ^ 739 | __tests__/test.c:29:20: error: There is function call, cannot determine that 1st argument is initialized. [bughuntingUninitArg] 740 | int len = strlen(str) + 1; 741 | ^ 742 | __tests__/test.c:118:65: note: Calling timestamp 743 | printf("[%s] SERVER: Exiting from Thread %ld\n", timestamp(), 744 | ^ 745 | __tests__/test.c:29:20: note: There is function call, cannot determine that 1st argument is initialized. 746 | int len = strlen(str) + 1; 747 | ^ 748 | __tests__/test.c:34:41: error: There is function call, cannot determine that 3rd argument value is valid. Bad value: less than 0 [bughuntingInvalidArgValue] 749 | strncpy(&str[i], &str[i + 1], len - i); 750 | ^ 751 | __tests__/test.c:118:65: note: Calling timestamp 752 | printf("[%s] SERVER: Exiting from Thread %ld\n", timestamp(), 753 | ^ 754 | __tests__/test.c:34:41: note: There is function call, cannot determine that 3rd argument value is valid. Bad value: less than 0 755 | strncpy(&str[i], &str[i + 1], len - i); 756 | ^ 757 | __tests__/test.c:34:14: error: Buffer read/write, when calling 'strncpy' it cannot be determined that 1st argument is not overflowed [bughuntingBufferOverflow] 758 | strncpy(&str[i], &str[i + 1], len - i); 759 | ^ 760 | __tests__/test.c:118:65: note: Calling timestamp 761 | printf("[%s] SERVER: Exiting from Thread %ld\n", timestamp(), 762 | ^ 763 | __tests__/test.c:34:14: note: Buffer read/write, when calling 'strncpy' it cannot be determined that 1st argument is not overflowed 764 | strncpy(&str[i], &str[i + 1], len - i); 765 | ^ 766 | __tests__/test.c:26:17: error: There is function call, cannot determine that 1st argument is initialized. [bughuntingUninitArg] 767 | str = asctime(local); 768 | ^ 769 | __tests__/test.c:124:49: note: Calling timestamp 770 | printf("[%s] CLIENT_%d@host:~$%s", timestamp(), client_fd - 3, buff); 771 | ^ 772 | __tests__/test.c:26:17: note: There is function call, cannot determine that 1st argument is initialized. 773 | str = asctime(local); 774 | ^ 775 | __tests__/test.c:29:20: error: There is function call, cannot determine that 1st argument is initialized. [bughuntingUninitArg] 776 | int len = strlen(str) + 1; 777 | ^ 778 | __tests__/test.c:124:49: note: Calling timestamp 779 | printf("[%s] CLIENT_%d@host:~$%s", timestamp(), client_fd - 3, buff); 780 | ^ 781 | __tests__/test.c:29:20: note: There is function call, cannot determine that 1st argument is initialized. 782 | int len = strlen(str) + 1; 783 | ^ 784 | __tests__/test.c:34:41: error: There is function call, cannot determine that 3rd argument value is valid. Bad value: less than 0 [bughuntingInvalidArgValue] 785 | strncpy(&str[i], &str[i + 1], len - i); 786 | ^ 787 | __tests__/test.c:124:49: note: Calling timestamp 788 | printf("[%s] CLIENT_%d@host:~$%s", timestamp(), client_fd - 3, buff); 789 | ^ 790 | __tests__/test.c:34:41: note: There is function call, cannot determine that 3rd argument value is valid. Bad value: less than 0 791 | strncpy(&str[i], &str[i + 1], len - i); 792 | ^ 793 | __tests__/test.c:34:14: error: Buffer read/write, when calling 'strncpy' it cannot be determined that 1st argument is not overflowed [bughuntingBufferOverflow] 794 | strncpy(&str[i], &str[i + 1], len - i); 795 | ^ 796 | __tests__/test.c:124:49: note: Calling timestamp 797 | printf("[%s] CLIENT_%d@host:~$%s", timestamp(), client_fd - 3, buff); 798 | ^ 799 | __tests__/test.c:34:14: note: Buffer read/write, when calling 'strncpy' it cannot be determined that 1st argument is not overflowed 800 | strncpy(&str[i], &str[i + 1], len - i); 801 | ^ 802 | __tests__/test.c:267:9: error: Buffer read/write, when calling 'memset' it cannot be determined that 1st argument is not overflowed [bughuntingBufferOverflow] 803 | memset(&thread_args, 0, sizeof(thread_args)); 804 | ^ 805 | __tests__/test.c:26:17: error: There is function call, cannot determine that 1st argument is initialized. [bughuntingUninitArg] 806 | str = asctime(local); 807 | ^ 808 | __tests__/test.c:332:74: note: Calling timestamp 809 | printf("[%s] SERVER: ERROR in creating the Thread %ld\n", timestamp(), 810 | ^ 811 | __tests__/test.c:26:17: note: There is function call, cannot determine that 1st argument is initialized. 812 | str = asctime(local); 813 | ^ 814 | __tests__/test.c:29:20: error: There is function call, cannot determine that 1st argument is initialized. [bughuntingUninitArg] 815 | int len = strlen(str) + 1; 816 | ^ 817 | __tests__/test.c:332:74: note: Calling timestamp 818 | printf("[%s] SERVER: ERROR in creating the Thread %ld\n", timestamp(), 819 | ^ 820 | __tests__/test.c:29:20: note: There is function call, cannot determine that 1st argument is initialized. 821 | int len = strlen(str) + 1; 822 | ^ 823 | __tests__/test.c:34:41: error: There is function call, cannot determine that 3rd argument value is valid. Bad value: less than 0 [bughuntingInvalidArgValue] 824 | strncpy(&str[i], &str[i + 1], len - i); 825 | ^ 826 | __tests__/test.c:332:74: note: Calling timestamp 827 | printf("[%s] SERVER: ERROR in creating the Thread %ld\n", timestamp(), 828 | ^ 829 | __tests__/test.c:34:41: note: There is function call, cannot determine that 3rd argument value is valid. Bad value: less than 0 830 | strncpy(&str[i], &str[i + 1], len - i); 831 | ^ 832 | __tests__/test.c:34:14: error: Buffer read/write, when calling 'strncpy' it cannot be determined that 1st argument is not overflowed [bughuntingBufferOverflow] 833 | strncpy(&str[i], &str[i + 1], len - i); 834 | ^ 835 | __tests__/test.c:332:74: note: Calling timestamp 836 | printf("[%s] SERVER: ERROR in creating the Thread %ld\n", timestamp(), 837 | ^ 838 | __tests__/test.c:34:14: note: Buffer read/write, when calling 'strncpy' it cannot be determined that 1st argument is not overflowed 839 | strncpy(&str[i], &str[i + 1], len - i); 840 | ^ 841 | __tests__/test.c:26:17: error: There is function call, cannot determine that 1st argument is initialized. [bughuntingUninitArg] 842 | str = asctime(local); 843 | ^ 844 | __tests__/test.c:340:21: note: Calling timestamp 845 | timestamp(), t_id, client_fd - 3); 846 | ^ 847 | __tests__/test.c:26:17: note: There is function call, cannot determine that 1st argument is initialized. 848 | str = asctime(local); 849 | ^ 850 | __tests__/test.c:29:20: error: There is function call, cannot determine that 1st argument is initialized. [bughuntingUninitArg] 851 | int len = strlen(str) + 1; 852 | ^ 853 | __tests__/test.c:340:21: note: Calling timestamp 854 | timestamp(), t_id, client_fd - 3); 855 | ^ 856 | __tests__/test.c:29:20: note: There is function call, cannot determine that 1st argument is initialized. 857 | int len = strlen(str) + 1; 858 | ^ 859 | __tests__/test.c:34:41: error: There is function call, cannot determine that 3rd argument value is valid. Bad value: less than 0 [bughuntingInvalidArgValue] 860 | strncpy(&str[i], &str[i + 1], len - i); 861 | ^ 862 | __tests__/test.c:340:21: note: Calling timestamp 863 | timestamp(), t_id, client_fd - 3); 864 | ^ 865 | __tests__/test.c:34:41: note: There is function call, cannot determine that 3rd argument value is valid. Bad value: less than 0 866 | strncpy(&str[i], &str[i + 1], len - i); 867 | ^ 868 | __tests__/test.c:34:14: error: Buffer read/write, when calling 'strncpy' it cannot be determined that 1st argument is not overflowed [bughuntingBufferOverflow] 869 | strncpy(&str[i], &str[i + 1], len - i); 870 | ^ 871 | __tests__/test.c:340:21: note: Calling timestamp 872 | timestamp(), t_id, client_fd - 3); 873 | ^ 874 | __tests__/test.c:34:14: note: Buffer read/write, when calling 'strncpy' it cannot be determined that 1st argument is not overflowed 875 | strncpy(&str[i], &str[i + 1], len - i); 876 | ^ 877 | __tests__/test.c:342:18: error: Array index out of bounds, cannot determine that ++thread_count is less than 20 [bughuntingArrayIndexOutOfBounds] 878 | threads_pool[++thread_count] = t_id; 879 | ^ 880 | __tests__/test.c:342:18: error: Array index out of bounds, cannot determine that ++thread_count is not negative [bughuntingArrayIndexNegative] 881 | threads_pool[++thread_count] = t_id; 882 | ^ 883 | nofile:0:0: information: Cppcheck cannot find all the include files. Cppcheck can check the code without the include files found. But the results will probably be more accurate if all the include files are found. Please check your project's include directories and add all of them as include directories for Cppcheck. To see what files Cppcheck cannot find use --check-config. [missingInclude] 884 | 885 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM facthunder/cppcheck 2 | ADD ./src/entrypoint.py /entrypoint.py 3 | ENTRYPOINT ["python", "/entrypoint.py"] 4 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 Dipankar Pal 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 |  3 | 4 | 5 |
13 | 14 | 15 | ## [subscribe to service updates](https://github.com/deep5050/cppcheck-action/issues/11) 16 | 17 | > ** Please participate on this 18 | > [poll](https://github.com/deep5050/cppcheck-action/issues/10) for a feature 19 | > planned by me ** 20 | 21 | 22 | ## What is cppcheck? 23 | 24 | [cppcheck](https://github.com/danmar/cppcheck) is a static analysis tool for 25 | C/C++ code. It provides unique code analysis to detect bugs and focuses on 26 | detecting undefined behavior and dangerous coding constructs. The goal is to 27 | have very few false positives. Cppcheck is designed to be able to analyze your 28 | C/C++ code even if it has non-standard syntax (common in embedded projects). 29 | 30 | ## How to use? 31 | 32 | Create `cppcheck.yml` under `.github/workflows` With the following contents 33 | 34 | ### Default configuration 35 | 36 | ```yml 37 | name: cppcheck-action-test 38 | on: [push] 39 | 40 | jobs: 41 | build: 42 | name: cppcheck-test 43 | runs-on: ubuntu-latest 44 | steps: 45 | - uses: actions/checkout@v2 46 | 47 | - name: cppcheck 48 | uses: deep5050/cppcheck-action@main 49 | with: 50 | github_token: ${{ secrets.GITHUB_TOKEN}} 51 | 52 | 53 | - name: publish report 54 | uses: mikeal/publish-to-github-action@master 55 | env: 56 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 57 | BRANCH_NAME: 'main' # your branch name goes here 58 | ``` 59 | 60 | ### Advanced configuration 61 | 62 | ```yml 63 | name: cppcheck-action 64 | on: [push] 65 | 66 | jobs: 67 | build: 68 | name: cppcheck 69 | runs-on: ubuntu-latest 70 | steps: 71 | - uses: actions/checkout@v2 72 | - name: cppcheck 73 | uses: deep5050/cppcheck-action@main 74 | with: 75 | github_token: ${{ secrets.GITHUB_TOKEN}} 76 | check_library: 77 | skip_preprocessor: 78 | enable: 79 | exclude_check: 80 | inconclusive: 81 | inline_suppression: 82 | force_language: 83 | force: 84 | max_ctu_depth: 85 | platform: 86 | std: 87 | output_file: 88 | other_options: 89 | 90 | - name: publish report 91 | uses: mikeal/publish-to-github-action@master 92 | env: 93 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 94 | BRANCH_NAME: 'main' # your branch name goes here 95 | ``` 96 | 97 | ### Input options 98 | 99 | | Option | Value | Description | Default | 100 | | :--- | :--- | :--- | :--- | 101 | | **check_library** | `enable`, `disable` | Show information messages when library files have incomplete info | `disable` | 102 | | **skip_preprocessor** | `enable`, `disable` | Print preprocessor output on stdout and don't do any further processing | `disable` | 103 | | **enable** | `all`, `warning`, `style`, `performance`, `portability`, `information`, `unusedFunction`, `missingInclude` | Enable additional checks. if you want to enable multiple checking at once, separate them using `,` without any blank space. example: `style,warning,performance` | `all` | 104 | | **exclude_check** | `./path/to/ignore` | Give a file or directory path to exclude from checking. example: `./no_check.cpp` | nothing to ignore | 105 | | **inconclusive** | `enable`, `disable` | Allow that Cppcheck reports even though the analysis is inconclusive | `enable` | 106 | | **inline_suppression** | `enable`, `disable` | Enable inline suppressions. Use them by placing one or more comments, like: '// cppcheck-suppress warningId' | `disable` | 107 | | **force_language** | `c`, `c++` | Forces cppcheck to check all files as the given language. Valid values are: `c`, `c++` | auto-detected | 108 | | **force** | `enable`, `disable` | Force checking of all configurations in files | `disable` | 109 | | **max_ctu_depth** | `number` | Max depth in whole program analysis. A larger value will mean more errors can be found but also means the analysis will be slower. example: `4` | `2` | 110 | | **platform** | `unix32`, `unix64`, `win32A`, `win32W`, `win64`, `avr8`, `elbrus-e1cp`, `pic8`, `pic8-enhanced`, `pic16`, `mips32`, `native`, `unspecified`, | Specifies platform specific types and sizes | `unspecified` | 111 | | **std** | `c89`, `c99`, `c11`, `c++11`, `c++14`, `c++17`, `c++20` | Set the C/C++ standard | `c11`, `c++20` | 112 | | **output_file** | `./path/to/output/file.txt` | Give a filename for the output report | `./cppcheck_report.txt` | 113 | | **other_options** | `--option1 --option2=value -opt3` | Any other options you want to add, separate with a space, wrong options will cause a failure. example: `--bug-hunting --verbose`| `disable` | 114 | 115 | 116 | For further details check 117 | [cppcheck documentations](http://cppcheck.sourceforge.net/manual.pdf) 118 | 119 | ## License 120 | 121 | > MIT License 122 | 123 | > Copyright (c) 2021 Dipankar Pal 124 | 125 | Permission is hereby granted, free of charge, to any person obtaining a copy of 126 | this software and associated documentation files (the "Software"), to deal in 127 | the Software without restriction, including without limitation the rights to 128 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 129 | the Software, and to permit persons to whom the Software is furnished to do so, 130 | subject to the following conditions: 131 | 132 | The above copyright notice and this permission notice shall be included in all 133 | copies or substantial portions of the Software. 134 | 135 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 136 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 137 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 138 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 139 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 140 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 141 | 142 | ## Thanks 143 | 144 | Icons made by 145 | Freepik 146 | from www.flaticon.com 147 | 148 | ## Contributors ✨ 149 | 150 | Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)): 151 | 152 | 153 | 154 | 155 |Bader ⚠️ |
158 | Stefan Hagen 🚇 ⚠️ 💻 |
159 |