Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(305)

Unified Diff: runtime/bin/secure_socket.cc

Issue 1390793002: Use strlen rather than strnlen, which is missing on Mac OS. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/secure_socket.cc
diff --git a/runtime/bin/secure_socket.cc b/runtime/bin/secure_socket.cc
index f2eaef96a270b51d93d9b35b8d29f5e9dad0627d..1b820083955438e0e704cd216cfa1de745a3496d 100644
--- a/runtime/bin/secure_socket.cc
+++ b/runtime/bin/secure_socket.cc
@@ -54,7 +54,7 @@ static void ThrowIOException(int status,
error_string[0] = '\0';
int error = ERR_get_error();
while (error != 0) {
- int length = strnlen(error_string, SSL_ERROR_MESSAGE_BUFFER_SIZE);
+ int length = strlen(error_string);
int free_length = SSL_ERROR_MESSAGE_BUFFER_SIZE - length;
if (free_length > 16) {
// Enough room for error code at least.
@@ -65,6 +65,7 @@ static void ThrowIOException(int status,
free_length--;
}
ERR_error_string_n(error, error_string + length, free_length);
+ // ERR_error_string_n is guaranteed to leave a null-terminated string.
}
error = ERR_get_error();
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698