NXiss7
Ok
NXiss7
These stuff are very fun to play with. Inject some code, store some binary in stack, put it on X perm region and jump there etc... 😄😄😄
klimi
lul
Nils
Can I use mmap() to allocate just 4 KB of memory anywhere instead of a predefined adress?
Nils
I don't care where it gets allocated as long as it returns a pointer 😅
Anonymous
Bro, any ideas for projects on C++ for advance level .. I'm in first year.. and already done few projects that I got on school days .. please suggest me some good things which I can work on..!
Anonymous
Thanks in advance.
klimi
calculatoooor
klimi
calculator
Anonymous
calculator
Why that??
klimi
its a project
NXiss7
Can I use mmap() to allocate just 4 KB of memory anywhere instead of a predefined adress?
Of course. You don't (and usually can't) specidy address. Use new keyword on C++ btw.
Anonymous
its a project
Elaborate it.. in what way you think it's going to test ones potential..
NXiss7
I don't care where it gets allocated as long as it returns a pointer 😅
Everything has a pointer then, try auto* ptr = &var; It will create a new pointer, pointing to address of var.
Anonymous
do it yourself
Just asking.
klimi
Just asking.
just answering
Nils
Can I create a variable at a size of 4 KB?
Wasn't it int var[40000]?
Hubert
Just asking.
this is an example
NXiss7
Can you give me an example?
char* buffer = new char[256];
Anonymous
this is an example
Okay.. thanks..
NXiss7
Ah, thank you.
You're welcome. But! Don't forget to delete[] buffer after you've done with it.
Nils
Everything has a pointer then, try auto* ptr = &var; It will create a new pointer, pointing to address of var.
bufferoverflow.cpp:15:8: error: conflicting declaration ‘auto* ptr’ 🤔?
NXiss7
You usually create a class and implement constructor and destructors to handle dynamic memory. Apply RAII!
Anonymous
Otherwise it would be heck called memory leakage..
Hubert
Ah, thank you.
the other way, you can also use calloc or malloc
NXiss7
bufferoverflow.cpp:15:8: error: conflicting declaration ‘auto* ptr’ 🤔?
I gave an example, adapt to your needs. You may have declared a var with name ptr...
Nils
the other way, you can also use calloc or malloc
His solution is better as I can just delete[] it
NXiss7
the other way, you can also use calloc or malloc
Yeah, but why bother C when you can use C++?
Nils
Nils
Ah, because a character has a size of 4? 🤔
NXiss7
His solution is better as I can just delete[] it
Intresting little fact: (It's impl-defined but) When you use new[] most compilers write size of alloc'd buffer just before alloc'd memory. Because it needs to know how many bytes to release when delete[]'d.
Nils
Ah.
NXiss7
And these are 2 KB?
No, it's 256 bytes. Size of a 2KB buffer would be 2048.
Nils
Okay.
Nils
No, it's 256 bytes. Size of a 2KB buffer would be 2048.
Wait, can I move my pointer out of such variable? Would be great if I couldn't 😅 That would reduce problems in case of broken brainfuck code.
NXiss7
1 byte = unsigned char
Nils
1 byte = unsigned char
Ah, okay. Signed means like utf-8 stuff, right?
Hubert
Ah, okay. Signed means like utf-8 stuff, right?
you can refer to data types in C++
NXiss7
No, signed means left-most bit reserved to indicate signedness
Hubert
uft-8 is unicode format
Nils
🤔 you confuse me
NXiss7
Ah, okay. Signed means like utf-8 stuff, right?
Unsigned there neans that "I won't store negative numbers, so that you can use all bits to represent a positive int".
Nils
Aaah. Okay.
NXiss7
🤔 you confuse me
Read bit more about data types in C/C++. 😅
Hubert
example : signed char (char) : the range from : -128 to 127 the unsigned char : range from : 0 to 255
NXiss7
Aaah. Okay.
Remember that you have finite resorces.
Nils
Remember that you have finite resorces.
Sometimes I wish having infinite 😅
Hubert
Sometimes I wish having infinite 😅
it can if hardware can adapt
Nils
Can you give me an example? XD
Hubert
if you want to extend memory, you need upgrade size of RAM. If you want to upgrade RAM, you must upgrade hardware to have more registers and logic gates, more logic gates need more transistors and resistors, ...
Nils
Even though the limit is near infinite but it is finite
NXiss7
How?
He's joking, look at his profile... That face tells a lot! 😄😄😄😄
NXiss7
Even though the limit is near infinite but it is finite
C'mon, we don't have infinite resources on the world. Enough off-topic btw.
Astral
Hello
Nils
Yeah.
Nils
NXiss7
You may get warn'd, read rules.
Astral
Hi
Sup?
Hubert
He's joking, look at his profile... That face tells a lot! 😄😄😄😄
that's just a little information in lower layer😅
NXiss7
😄😄😄😄
Astral
Wanna lear c
Astral
Any book?