Skip to content

Commit

Permalink
[v1.06][ARM] Fix two off-by-one bugs (#264)
Browse files Browse the repository at this point in the history
  • Loading branch information
Dr-Noob committed Aug 19, 2024
1 parent 8d10a03 commit aa94389
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/arm/midr.c
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@ char* get_str_topology(struct cpuInfo* cpu, struct topology* topo, bool dual_soc

char* get_str_features(struct cpuInfo* cpu) {
struct features* feat = cpu->feat;
uint32_t max_len = strlen("NEON,SHA1,SHA2,AES,CRC32,SVE,SVE2") + 1;
uint32_t max_len = strlen("NEON,SHA1,SHA2,AES,CRC32,SVE,SVE2,") + 1;
uint32_t len = 0;
char* string = ecalloc(max_len, sizeof(char));

Expand Down
6 changes: 3 additions & 3 deletions src/common/pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,9 @@ void populate_pci_devices(struct pci_devices * pci) {
int path_size = strlen(PCI_PATH) + strlen(dev->path) + 2;

// Read vendor_id
char *vendor_id_path = emalloc(sizeof(char) * (path_size + strlen("vendor")));
char *vendor_id_path = emalloc(sizeof(char) * (path_size + strlen("vendor") + 1));
sprintf(vendor_id_path, "%s/%s/%s", PCI_PATH, dev->path, "vendor");

if ((buf = read_file(vendor_id_path, &filelen)) == NULL) {
printWarn("read_file: %s: %s\n", vendor_id_path, strerror(errno));
dev->vendor_id = 0;
Expand All @@ -110,7 +110,7 @@ void populate_pci_devices(struct pci_devices * pci) {
}

// Read device_id
char *device_id_path = emalloc(sizeof(char) * (path_size + strlen("device")));
char *device_id_path = emalloc(sizeof(char) * (path_size + strlen("device") + 1));
sprintf(device_id_path, "%s/%s/%s", PCI_PATH, dev->path, "device");

if ((buf = read_file(device_id_path, &filelen)) == NULL) {
Expand Down

0 comments on commit aa94389

Please sign in to comment.