Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 30a68de

Browse files
Creating a std::string with a null pointer is undefined behaviour.
- cppreference mentions this about the constructor that receives a const char *: - Constructs the string with the contents initialized with a copy of the null-terminated character string pointed to by s. The length of the string is determined by the first null character. The behavior is undefined if [s, s + Traits::length(s)) is not a valid range (for example, if s is a null pointer). - C++23 introduces a deleted constructor to prevent this in static scenarios, which is how this issue was detected.
1 parent e8db92e commit 30a68de

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

‎headers/modsecurity/rules_set_properties.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,9 +333,9 @@ class RulesSetProperties {
333333
case FalseConfigBoolean:
334334
return "False";
335335
case PropertyNotSetConfigBoolean:
336+
default:
336337
return "Not set";
337338
}
338-
return NULL;
339339
}
340340

341341

‎src/actions/transformations/url_encode.cc‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ std::string UrlEncode::url_enc(const char *input,
4848
len = input_len * 3 + 1;
4949
d = rval = reinterpret_cast<char *>(malloc(len));
5050
if (rval == NULL) {
51-
return NULL;
51+
return {};
5252
}
5353

5454
/* ENH Only encode the characters that really need to be encoded. */

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /