- Timestamp:
- Sep 5, 2021, 12:40:51 PM (3 years ago)
- Location:
- trunk/src
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bignum.c
r544 r570 175 175 for (base = 2; base <= 36; base++) 176 176 { 177 tmp = ((1 << (DIGIT_BITS - 1)) / base);177 tmp = ((1U << (DIGIT_BITS - 1)) / base); 178 178 maxdigit = tmp * 2; 179 179 curdigit = 1; -
trunk/src/sh_extern.c
r491 r570 993 993 if (sh_string_len(s) == 0) 994 994 { 995 /* cppcheck-suppress syntaxError */ 995 996 --try; retry_msleep(0, 100); 996 997 } -
trunk/src/sh_hash.c
r550 r570 2031 2031 sl_strlen(theFile->link_path), 2032 2032 hashbuf, sizeof(hashbuf)), 2033 MAX_PATH_STORE+1);2033 sizeof(linkHash)); 2034 2034 linkComp = linkHash; 2035 2035 maxcomp = KEY_LEN; -
trunk/src/sh_static.c
r552 r570 464 464 { 465 465 FILE *grf; 466 gid_t *group_list; 467 int num_groups, rv; 466 gid_t *group_list = NULL; 467 size_t num_groups; 468 int rv; 468 469 char **m; 469 470 struct group group; … … 474 475 475 476 /* We alloc space for 8 gids at a time. */ 476 if ( ((group_list = calloc(8,sizeof(gid_t *))) != NULL)477 if (buff && ((group_list = calloc(8,sizeof(gid_t *))) != NULL) 477 478 && ((grf = fopen(_PATH_GROUP, "r")) != NULL) 478 479 ) { … … 489 490 if (!strcmp(*m, user)) { 490 491 if (!(num_groups & 7)) { 491 gid_t *tmp = (gid_t *) 492 realloc(group_list, 493 (num_groups+8) * sizeof(gid_t *)); 494 if (!tmp) { 495 rv = -1; 496 goto DO_CLOSE; 497 } 498 group_list = tmp; 492 gid_t *tmp = NULL; 493 if (num_groups > (SIZE_MAX - 8)) { 494 rv = -1; 495 goto DO_CLOSE; 496 } 497 if ((num_groups+8) <= (SIZE_MAX / sizeof(gid_t *))) { 498 tmp = (gid_t *) 499 realloc(group_list, 500 (num_groups+8) * sizeof(gid_t *)); 501 } 502 if (!tmp) { 503 rv = -1; 504 goto DO_CLOSE; 505 } 506 group_list = tmp; 499 507 } 500 508 group_list[num_groups++] = group.gr_gid; … … 512 520 /* group_list will be NULL if initial malloc failed, which may trigger 513 521 * warnings from various malloc debuggers. */ 514 free(group_list); 515 free(buff); 522 if (group_list) free(group_list); 523 if (buff) free(buff); 524 /* cppcheck-suppress resourceLeak */ 516 525 return rv; 517 526 } -
trunk/src/sh_unix.c
r550 r570 3904 3904 if (errno == EBADF && try == 0) /* obsolete, but we keep this, just in case */ 3905 3905 { 3906 /* cppcheck-suppress syntaxError */ 3906 3907 ++try; 3907 3908 goto try_again; -
trunk/src/sh_utils.c
r560 r570 1246 1246 } 1247 1247 1248 if (NULL == (new = calloc(1,strlen(new_in) + 1))) 1248 len = strlen(new_in) + 1; 1249 if (NULL == (new = calloc(1, len))) 1249 1250 goto bail_mem; 1250 sl_strncpy(new, new_in, strlen(new_in) + 1);1251 memcpy(new, new_in, len); 1251 1252 1252 1253 key = new;
Note:
See TracChangeset
for help on using the changeset viewer.