Skip to content

Commit

Permalink
Fix compile warning regarding unecessary right shift
Browse files Browse the repository at this point in the history
No point shifting a 16bit variable more than 16 bits.
  • Loading branch information
micahsnyder committed Mar 21, 2024
1 parent b87cf97 commit 4098df4
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions libclamav/ole2_extract.c
Original file line number Diff line number Diff line change
Expand Up @@ -256,8 +256,8 @@ cli_ole2_get_property_name2(const char *name, int size)
if ((name[0] == 0 && name[1] == 0) || size <= 0 || size > 128) {
return NULL;
}
CLI_MAX_MALLOC_OR_GOTO_DONE(newname, size * 7,
cli_errmsg("OLE2 [cli_ole2_get_property_name2]: Unable to allocate memory for newname: %u\n", size * 7));
CLI_MAX_MALLOC_OR_GOTO_DONE(newname, size * 5,
cli_errmsg("OLE2 [cli_ole2_get_property_name2]: Unable to allocate memory for newname: %u\n", size * 5));

j = 0;
/* size-2 to ignore trailing NULL */
Expand All @@ -275,8 +275,6 @@ cli_ole2_get_property_name2(const char *name, int size)
newname[j++] = 'a' + ((x & 0xF));
newname[j++] = 'a' + ((x >> 4) & 0xF);
newname[j++] = 'a' + ((x >> 8) & 0xF);
newname[j++] = 'a' + ((x >> 16) & 0xF);
newname[j++] = 'a' + ((x >> 24) & 0xF);
}
newname[j++] = '_';
}
Expand Down

0 comments on commit 4098df4

Please sign in to comment.