The following issues were found
scripts/kconfig/lxdialog/checklist.c
2 issues
Line: 23
Column: 2
CWE codes:
120
int i;
char *list_item = malloc(list_width + 1);
strncpy(list_item, item_str(), list_width - item_x);
list_item[list_width - item_x] = '\0';
/* Clear 'residue' of last item */
wattrset(win, dlg.menubox.atr);
wmove(win, choice, 0);
Reported by FlawFinder.
Line: 169
Column: 26
CWE codes:
126
/* Find length of longest item in order to center checklist */
check_x = 0;
item_foreach()
check_x = MAX(check_x, strlen(item_str()) + 4);
check_x = MIN(check_x, list_width);
check_x = (list_width - check_x) / 2;
item_x = check_x + 4;
Reported by FlawFinder.
sound/synth/emux/emux_proc.c
2 issues
Line: 95
Column: 2
CWE codes:
119
120
Suggestion:
Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length
void snd_emux_proc_init(struct snd_emux *emu, struct snd_card *card, int device)
{
struct snd_info_entry *entry;
char name[64];
sprintf(name, "wavetableD%d", device);
entry = snd_info_create_card_entry(card, name, card->proc_root);
if (entry == NULL)
return;
Reported by FlawFinder.
Line: 97
Column: 2
CWE codes:
120
Suggestion:
Use sprintf_s, snprintf, or vsnprintf
struct snd_info_entry *entry;
char name[64];
sprintf(name, "wavetableD%d", device);
entry = snd_info_create_card_entry(card, name, card->proc_root);
if (entry == NULL)
return;
entry->content = SNDRV_INFO_CONTENT_TEXT;
Reported by FlawFinder.
scripts/gcc-plugins/randomize_layout_plugin.c
2 issues
Line: 70
Column: 21
CWE codes:
126
name_hash(const unsigned char *name)
{
unsigned long hash = 0;
unsigned int len = strlen((const char *)name);
while (len--)
hash = partial_name_hash(*name++, hash);
return (unsigned int)hash;
}
Reported by FlawFinder.
Line: 967
Column: 6
CWE codes:
126
error(G_("unknown option '-fplugin-arg-%s-%s'"), plugin_name, argv[i].key);
}
if (strlen(randstruct_seed) != 64) {
error(G_("invalid seed value supplied for %s plugin"), plugin_name);
return 1;
}
obtained_seed = sscanf(randstruct_seed, "%016llx%016llx%016llx%016llx",
&shuffle_seed[0], &shuffle_seed[1], &shuffle_seed[2], &shuffle_seed[3]);
Reported by FlawFinder.
scripts/gcc-plugins/arm_ssp_per_task_plugin.c
2 issues
Line: 95
Column: 10
CWE codes:
190
Suggestion:
If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended)
}
if (!strcmp(argv[i].key, "tso")) {
tso = atoi(argv[i].value);
continue;
}
if (!strcmp(argv[i].key, "offset")) {
canary_offset = atoi(argv[i].value);
Reported by FlawFinder.
Line: 100
Column: 20
CWE codes:
190
Suggestion:
If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended)
}
if (!strcmp(argv[i].key, "offset")) {
canary_offset = atoi(argv[i].value);
continue;
}
error(G_("unknown option '-fplugin-arg-%s-%s'"),
plugin_name, argv[i].key);
return 1;
Reported by FlawFinder.
scripts/mod/mk_elfconfig.c
2 issues
Line: 10
Column: 11
CWE codes:
119
120
Suggestion:
Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length
int
main(int argc, char **argv)
{
unsigned char ei[EI_NIDENT];
union { short s; char c[2]; } endian_test;
if (fread(ei, 1, EI_NIDENT, stdin) != EI_NIDENT) {
fprintf(stderr, "Error: input truncated\n");
return 1;
Reported by FlawFinder.
Line: 11
Column: 19
CWE codes:
119
120
Suggestion:
Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length
main(int argc, char **argv)
{
unsigned char ei[EI_NIDENT];
union { short s; char c[2]; } endian_test;
if (fread(ei, 1, EI_NIDENT, stdin) != EI_NIDENT) {
fprintf(stderr, "Error: input truncated\n");
return 1;
}
Reported by FlawFinder.
scripts/dtc/libfdt/fdt_wip.c
2 issues
Line: 29
Column: 2
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
if ((unsigned)proplen < (len + idx))
return -FDT_ERR_NOSPACE;
memcpy((char *)propval + idx, val, len);
return 0;
}
int fdt_setprop_inplace(void *fdt, int nodeoffset, const char *name,
const void *val, int len)
Reported by FlawFinder.
Line: 47
Column: 10
CWE codes:
126
return -FDT_ERR_NOSPACE;
return fdt_setprop_inplace_namelen_partial(fdt, nodeoffset, name,
strlen(name), 0,
val, len);
}
static void fdt_nop_region_(void *start, int len)
{
Reported by FlawFinder.
drivers/media/pci/mantis/mantis_common.h
2 issues
Line: 167
Column: 2
CWE codes:
119
120
Suggestion:
Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length
struct work_struct uart_work;
struct rc_dev *rc;
char device_name[80];
char input_phys[80];
char *rc_map_name;
};
#define MANTIS_HIF_STATUS (mantis->gpio_status)
Reported by FlawFinder.
Line: 168
Column: 2
CWE codes:
119
120
Suggestion:
Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length
struct rc_dev *rc;
char device_name[80];
char input_phys[80];
char *rc_map_name;
};
#define MANTIS_HIF_STATUS (mantis->gpio_status)
Reported by FlawFinder.
drivers/misc/cxl/api.c
2 issues
Line: 410
Column: 14
CWE codes:
362
* Patch the file ops. Needs to be careful that this is rentrant safe.
*/
if (fops) {
PATCH_FOPS(open);
PATCH_FOPS(poll);
PATCH_FOPS(read);
PATCH_FOPS(release);
PATCH_FOPS(unlocked_ioctl);
PATCH_FOPS(compat_ioctl);
Reported by FlawFinder.
Line: 412
Column: 14
CWE codes:
120
20
if (fops) {
PATCH_FOPS(open);
PATCH_FOPS(poll);
PATCH_FOPS(read);
PATCH_FOPS(release);
PATCH_FOPS(unlocked_ioctl);
PATCH_FOPS(compat_ioctl);
PATCH_FOPS(mmap);
} else /* use default ops */
Reported by FlawFinder.
drivers/mmc/core/sdio_bus.c
2 issues
Line: 38
Column: 9
CWE codes:
134
Suggestion:
Make format string constant
struct sdio_func *func; \
\
func = dev_to_sdio_func (dev); \
return sprintf(buf, format_string, args); \
} \
static DEVICE_ATTR_RO(field)
sdio_config_attr(class, "0x%02x\n", func->class);
sdio_config_attr(vendor, "0x%04x\n", func->vendor);
Reported by FlawFinder.
Line: 57
Column: 9
CWE codes:
120
Suggestion:
Use sprintf_s, snprintf, or vsnprintf
return -ENODATA; \
if (!func->info[num-1][0]) \
return 0; \
return sprintf(buf, "%s\n", func->info[num-1]); \
} \
static DEVICE_ATTR_RO(info##num)
sdio_info_attr(1);
sdio_info_attr(2);
Reported by FlawFinder.
drivers/misc/cxl/debugfs.c
2 issues
Line: 60
Column: 2
CWE codes:
119
120
Suggestion:
Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length
void cxl_debugfs_adapter_add(struct cxl *adapter)
{
struct dentry *dir;
char buf[32];
if (!cxl_debugfs)
return;
snprintf(buf, 32, "card%i", adapter->adapter_num);
Reported by FlawFinder.
Line: 99
Column: 2
CWE codes:
119
120
Suggestion:
Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length
void cxl_debugfs_afu_add(struct cxl_afu *afu)
{
struct dentry *dir;
char buf[32];
if (!afu->adapter->debugfs)
return;
snprintf(buf, 32, "psl%i.%i", afu->adapter->adapter_num, afu->slice);
Reported by FlawFinder.