Using untrusted input to created with the built-in make function + could lead to excessive memory allocation and potentially cause the program to crash due + to running out of memory. This vulnerability could be exploited to perform a DoS attack by consuming all available server resources.
+Implement a maximum allowed value for creates a slice with the built-in make function to prevent excessively large allocations. + For instance, you could restrict it to a reasonable upper limit.
+In the following example snippet, the n field is user-controlled.
The server trusts that n has an acceptable value, however when using a maliciously large value,
+ it allocates a slice of n of strings before filling the slice with data.
One way to prevent this vulnerability is by implementing a maximum allowed value for the user-controlled input:
+ +