Last active
December 4, 2021 07:08
-
-
Save 0rbianta/9f6494247892ca37e45337461f125dc8 to your computer and use it in GitHub Desktop.
Overflow-safe string input for C
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <string.h> | |
void stdinputs(char *strbuff, int len) | |
{ | |
char *usr; | |
scanf("%ms", &usr); | |
strncpy(strbuff, usr, len); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment