I'll just leave this here

I'll just leave this here

Attached: 450eab9d.png (454x251, 7K)

Other urls found in this thread:

youtube.com/watch?v=rVmv46kcmsg
twitter.com/SFWRedditGifs

Why? Is it 1994?

why not
char name[]; ?

disgusting

why?

That's prone to overflow errors

oh look it's another one of these newfag thinks he's hot shit for knowing what a buffer overflow is threads

youtube.com/watch?v=rVmv46kcmsg

>not using fgets

Attached: b14t5qno55l01.jpg (1439x1679, 841K)

fgets at least doesn't overflow when you shove long strings down its throat

>using C for apps dealing with strings
yikes

1) What happens if I write a name 16 characters or longer?
2) Why are you assuming my gender?

Attached: triggered-space.png (600x400, 407K)

I tried to convert an int to a string using itoa and forgot to give a size to the destination array, which I think caused me to overwrite the bootloader of 2 MCUs.

>not using sscanf
It's like you want your program to crash desu.

>Mr.
Get off my blog you filthy sexist transphobe, check your privilege

>apps
yikes

std::string doesn't have this problem

So it's basically a rorshasch test: Do you see the buffer overflow or the gender assuming?

I saw both.

Can you stop reposting this? Everyone can see the buffer overflow from the thumbnail in the catalog at this point.

echo "Please enter your name: "
var name = readLine(stdin)
echo "Hello Mr. ", name, "!"

It's C - buffer overflow is a standard feature.

Genuine question:
What's the correct way to write this (without buffer overflows)? I'm trying to remember but the most I can come up with is a call to `fgets` with stdin as the last argument.
However, It may be the case the user inputs a string that's too long to read into the buffer you provide. How would you know this is the case and how would you work around that?

Forgot to add this:
Would you need to use the feof(stdin)function?

fgets(3) or your own implementation using read(2)

>yikes
yuck

name = input('Please enter your name')
print(f'Hello Mr. {name}!')

f-strings are the shit in Python

>Error: unspecified array size

>Not supplying a string literal

>not using fread

>Using turtle

>not having a buffer and bounds checking it. LMAO all I need is to type 20 letters and your program crashes. That's the type of shit code only a 9th grader would type.

>LMAO all I need is to type 20 letters and your program crashes.
Or ROP chain the fuck out of it.

String selector of scanf can take a length variable, it will not write more than that and no buffer overflow would happen.

You can either limit the input length or use a linked list to store the data for arbitrarily large input sizes.

#include
#include

int main()
{
std::string name;
std::cout

notepad++
kys winfag

why not
string name;
?

it's C ya dingus

This is gender non-inclusive as Mr. refers to a male, disregarding Mrs. or Ms.
I am deeply triggered.

Attached: systeMD.png (709x752, 724K)

>using the heap

It will let you type in whatever size string you want (up to the limits of char)

Then you'd have to include a whole new library

Alright, we'll change if for you, Shawnqueeshataqueelia

using String = std::basic_string;

typedef char string[16];

#include

int main ()
{
char name [16];
printf("Enter your name: ");
gets(name);
printf("Hello Mr. %s!\n", name);

return 0;
}

>assuming gender

Attached: self portrait.png (160x144, 3K)