With 'padding' explicitly filled with all spaces string copy operations
may result in unexpected values. Padding is extended by 1 and null
terminated to avoid unexpected behavior.
(via cppcheck)
Change-Id: I8a9845ae87002018705ad23c2b089c8ef571b7bc
Reviewed-on: https://gerrit.openafs.org/13164
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
"---------------------------\n");
for (i = 0; i < num_log_records; i ++)
{
- char padding[40];
- strcpy(padding, " ");
+ char padding[41];
+ memset(padding, ' ', sizeof(padding) - 1);
+ padding[40] = '\0';
if (30-strlen(log_records[i].name) >= 0){
padding[30-strlen(log_records[i].name)] = '\0';
}