Skip to content

Commit

Permalink
Raise size cap when reading process environment. Fixes #2459
Browse files Browse the repository at this point in the history
  • Loading branch information
davidebbo committed Jun 3, 2017
1 parent fb9a9a6 commit 79af80d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Kudu.Core/Infrastructure/ProcessExtensions.cs
Expand Up @@ -494,7 +494,8 @@ private static void SafeKillProcess(Process process, ITracer tracer)
throw new Win32Exception("Unable to read environment block.");
}

const int maxEnvSize = 32767;
// Limit env size to 10 MB to be defensive
const int maxEnvSize = 10 * 1000 * 1000;

This comment has been minimized.

Copy link
@suwatch

suwatch Jun 3, 2017

Member

thanks. nit: 10 * 1024 *1024 would be slight more accurate.

This comment has been minimized.

Copy link
@davidebbo

davidebbo Jun 3, 2017

Author Member

Dude, who cares :)

This comment has been minimized.

Copy link
@davidfowl

davidfowl Jun 3, 2017

Member

A kilobyte uses the kilo- S.I. prefix which means 1000 times something. That is, 1 KB is 1000 bytes. A kibibyte uses the prefix kibi- which I'm not sure whether it's S.I. or not. kibi- means 1024 times something, so 1 KiB is 1024 bytes.

🤓

This comment has been minimized.

Copy link
@davidebbo

davidebbo Jun 3, 2017

Author Member

Right, so what I have here is exactly 10 megabytes, and not 10 mebibytes! Because frankly, 'mebibyte' sounds ridiculous.

if (dataSize > maxEnvSize)
{
dataSize = maxEnvSize;
Expand Down

0 comments on commit 79af80d

Please sign in to comment.