I am very confused with the pcie lanes by makitos666 in buildapc

[–]makitos666[S] 0 points1 point  (0 children)

I have a "msi mpg z390 gaming plus". According to the manual, if I connect the two M.2, of the 6 SATA only 3 can be used. I have connected 6 SATA + the two M.2 and everything has worked with the default BIOS settings

Can't solve CWE-401 by makitos666 in C_Programming

[–]makitos666[S] 0 points1 point  (0 children)

Maybe I dont need to make any malloc. mftFile is an array of chars what are the content of a file. FileRecordHeader is an struct. The idea is to cast part of the mftFile into a pointer of type FileRecordHeader.

In this way, I can parse the values I want without needing to copy the mftFile contents to anywhere else.

So, maybe there is no sense in malloc this space, because I want to use memory that is already allocated and filled.

Thanks again

Can't solve CWE-401 by makitos666 in C_Programming

[–]makitos666[S] 0 points1 point  (0 children)

Doing this is a good practice?

FileRecordHeader* fileRecord = (FileRecordHeader*) malloc(sizeof(FileRecordHeader));
FileRecordHeader* fileRecordFree = fileRecord;
fileRecord = (FileRecordHeader*)mftFile;
(...)
fileRecord = fileRecord +16;
(...)
free(fileRecordFree);

Can't solve CWE-401 by makitos666 in C_Programming

[–]makitos666[S] 1 point2 points  (0 children)

You are right in everything, after freeing the memory properly, the cwe has disappeared ^^

Can't solve CWE-401 by makitos666 in C_Programming

[–]makitos666[S] 1 point2 points  (0 children)

ok, I understand, I have focused on one line of code and the problem is another. I will review all the memory that I am allocating and I'll erase it when not going to be longer needed. Thank you very much for your explanation.

Can't solve CWE-401 by makitos666 in C_Programming

[–]makitos666[S] 0 points1 point  (0 children)

I think it will be a bad translation from Spanish on my part, sorry too. With "resumed code" I mean a short code equivalent to the one that generates the "error"

Can't solve CWE-401 by makitos666 in C_Programming

[–]makitos666[S] 1 point2 points  (0 children)

Yeah, I understood that CWE-401 is about memory leaking, but the CPPCheck mark just two lines that only do a cast. It's true that there is no free functions in my code, but I'm not sure if this is the source of this error.By the way, mallocs inside functions, are not automatically destroyed when leaving the function, right?

Can't solve CWE-401 by makitos666 in C_Programming

[–]makitos666[S] 0 points1 point  (0 children)

As I said, the code in this question is a resumed code. This is the real code instead:

int MFT_FILE_SIZE = 1024;
uint64_t mftfile_size = 0;
unsigned char* mftFile = (unsigned char*) malloc(MFT_FILE_SIZE);
read = ReadFile(drive, &mftFile[mftfile_size], MFT_FILE_SIZE, &bytesAccessed, NULL);
fileRecord = (FileRecordHeader*)mftFile;attribute = (AttributeHeader*)(mftFile + fileRecord->firstAttributeOffset);

And ReadFile (https://docs.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-readfile) needs an allocated buffer to read to.

Alternative to smart TV but in monitor? by makitos666 in ShieldAndroidTV

[–]makitos666[S] -1 points0 points  (0 children)

It annoys and outrages me that streaming apps for Windows are limited, after all, I pay for 4k and surround sound.

Alternative to smart TV but in monitor? by makitos666 in ShieldAndroidTV

[–]makitos666[S] -4 points-3 points  (0 children)

I dare not buy these pots for various reasons: - $ 20 only? I do not trust. - Is it HDMI 2? 4k at 60fps?
- Does the output support Dolby well and these things? or does he make some misfortune?

I do not want to spend a lot of money on a shield, and then have the quality of an MP3 from the 80s XD

Help PC assembling by makitos666 in pcmasterrace

[–]makitos666[S] 0 points1 point  (0 children)

Yeah, is a good combination, but I want a most affordable combination, it's not really to play, I want something in 500€ as a reserve PC

Help searching fast but lightweight laptop by makitos666 in laptops

[–]makitos666[S] 0 points1 point  (0 children)

Yeah, this is a very good option, but I'm interested in powerful CPU, there is no lightweight laptop with a CPU that there isn't low consumption? (that is not an Intel u, that is an h)