diff options
author | Nikias Bassen | 2022-11-02 13:18:38 +0100 |
---|---|---|
committer | Nikias Bassen | 2022-11-02 13:18:38 +0100 |
commit | 8778188bc3d4755499563aca618bf51f8f9f2444 (patch) | |
tree | f261973cbcb8b2de181075886ee12f61ed04abe7 /src | |
parent | c3af449543795ad4d3ab178120ff69e90fdd2cc8 (diff) | |
download | libplist-8778188bc3d4755499563aca618bf51f8f9f2444.tar.gz libplist-8778188bc3d4755499563aca618bf51f8f9f2444.tar.bz2 |
jplist: Prevent multiplication overflow by casting to larger type
Found by CodeQL
Diffstat (limited to 'src')
-rw-r--r-- | src/jplist.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/jplist.c b/src/jplist.c index e615299..d12540e 100644 --- a/src/jplist.c +++ b/src/jplist.c @@ -324,7 +324,7 @@ static int node_estimate_size(node_t *node, uint64_t *size, uint32_t depth, int *size += n_children-1; // number of ':' and ',' if (prettify) { *size += n_children; // number of '\n' and extra space - *size += n_children * (depth+1); // indent for every 2nd child + *size += (uint64_t)n_children * (depth+1); // indent for every 2nd child *size += 1; // additional '\n' } break; @@ -333,7 +333,7 @@ static int node_estimate_size(node_t *node, uint64_t *size, uint32_t depth, int *size += n_children-1; // number of ',' if (prettify) { *size += n_children; // number of '\n' - *size += n_children * ((depth+1)<<1); // indent for every child + *size += (uint64_t)n_children * ((depth+1)<<1); // indent for every child *size += 1; // additional '\n' } break; |