mirror of
https://github.com/TheAlgorithms/C
synced 2024-11-22 05:21:49 +03:00
fix LGTM - limit malloc range
This commit is contained in:
parent
619620d65d
commit
6710df7ec3
@ -50,9 +50,13 @@ void PrintSortedPermutations(char *str)
|
||||
|
||||
int main()
|
||||
{
|
||||
unsigned int n; // size of string
|
||||
scanf("%u\n", &n);
|
||||
|
||||
int n; // size of string
|
||||
scanf("%d\n", &n);
|
||||
if (n <= 0 || n >= 1000)
|
||||
{
|
||||
perror("Input number out of range: >0 and <1000\n");
|
||||
return -1;
|
||||
}
|
||||
char *str = (char *)malloc(n * sizeof(char));
|
||||
scanf("%s", str);
|
||||
PrintSortedPermutations(str);
|
||||
|
Loading…
Reference in New Issue
Block a user