-
-
Notifications
You must be signed in to change notification settings - Fork 706
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
Conversation
There was a problem hiding this 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; | |||
There was a problem hiding this comment.
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; | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
Huh, I thought I fixed both, let me see. |
|
Updated with spaces around |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this 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
|
|
Updated. |
https://issues.dlang.org/show_bug.cgi?id=17102