[Lldb-commits] [PATCH] UriParser - fixed potential buffer overrun

Oleksiy Vyalov ovyalov at google.com
Mon Jan 12 11:00:55 PST 2015


REPOSITORY
  rL LLVM

================
Comment at: /Users/vharron/ll/svn/lldb/source/Utility/UriParser.cpp:42
@@ -42,1 +41,3 @@
+    char* end = nullptr;
     int port_tmp = strtoul(port_buf, &end, 10);
+    if (*end != 0 || port_tmp > 65535)
----------------
You may define port_tmp as auto instead of integer - otherwise if result of strtoul is greater than MAX_INT but less than max of unsigned long int it might be just a negative number.

================
Comment at: /Users/vharron/ll/svn/lldb/source/Utility/UriParser.cpp:43
@@ -42,3 +42,3 @@
     int port_tmp = strtoul(port_buf, &end, 10);
-    if (*end != 0)
+    if (*end != 0 || port_tmp > 65535)
     {
----------------
Check for portr_tmp <= 0?

http://reviews.llvm.org/D6918

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the lldb-commits mailing list