Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix issue 17102 - Don't pass null to strlen in std.file.cenforce #5049

Merged
merged 1 commit into from
Jan 21, 2017

Conversation

Burgos
Copy link
Member

@Burgos Burgos commented Jan 20, 2017

@Burgos Burgos changed the title Don't pass null to strlen in std.file.cenforce fix issue 17102 Don't pass null to strlen in std.file.cenforce Jan 20, 2017
@Burgos Burgos changed the title fix issue 17102 Don't pass null to strlen in std.file.cenforce fix issue 17102 - Don't pass null to strlen in std.file.cenforce Jan 20, 2017
Copy link
Member

@JackStouffer JackStouffer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only the windows version?

@@ -179,7 +179,7 @@ private T cenforce(T)(T condition, const(char)[] name, const(FSChar)* namez,
import core.stdc.wchar_ : wcslen;
import std.conv : to;

auto len = wcslen(namez);
auto len = namez? wcslen(namez) : 0;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

space around ?

@@ -196,12 +196,23 @@ private T cenforce(T)(T condition, const(char)[] name, const(FSChar)* namez,
{
import core.stdc.string : strlen;

auto len = strlen(namez);
auto len = namez? strlen(namez) : 0;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto

@Burgos
Copy link
Member Author

Burgos commented Jan 21, 2017

Only the windows version?

Huh, I thought I fixed both, let me see.

@Burgos
Copy link
Member Author

Burgos commented Jan 21, 2017

Updated with spaces around ?.

Copy link
Member

@PetarKirov PetarKirov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Member

@JackStouffer JackStouffer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, but please change commit message to Fix Issue 17102: std.write.file generates a segmentation fault when the file name is a string with a default value

file name is a string with a default value

While trying to build the file name for exception
from 0terminated namez, don't pass null to strlen
@dlang-bot
Copy link
Contributor

Fix Bugzilla Description
17102 std.write.file generates a segmentation fault when the file name is a string with a default value

@Burgos
Copy link
Member Author

Burgos commented Jan 21, 2017

Updated.

@dlang-bot dlang-bot merged commit c6d3350 into dlang:master Jan 21, 2017
@Burgos Burgos deleted the fix-17102 branch January 21, 2017 19:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants