https://issues.apache.org/bugzilla/show_bug.cgi?id=55696

--- Comment #10 from Christopher Schultz <ch...@christopherschultz.net> ---
I have verified that this patch works under both Linux and OS X Mavericks. I'll
commit shortly.

Index: native/common/jk_map.c
===================================================================
--- native/common/jk_map.c    (revision 1535519)
+++ native/common/jk_map.c    (working copy)
@@ -183,33 +183,37 @@

 int jk_map_get_int(jk_map_t *m, const char *name, int def)
 {
-    char buf[100];
     const char *rc;
-    size_t len;
     int int_res;
-    int multit = 1;

-    sprintf(buf, "%d", def);
-    rc = jk_map_get_string(m, name, buf);
+    rc = jk_map_get_string(m, name, NULL);

-    len = strlen(rc);
-    if (len) {
-        char *lastchar = &buf[0] + len - 1;
-        strcpy(buf, rc);
-        if ('m' == *lastchar || 'M' == *lastchar) {
-            *lastchar = '\0';
-            multit = 1024 * 1024;
+    if(NULL == rc) {
+        int_res = def;
+    } else {
+        size_t len = strlen(rc);
+        int multit = 1;
+
+        if (len) {
+            char buf[100];
+            char *lastchar;
+            strncpy(buf, rc, 100);
+        lastchar = buf + len - 1;
+            if ('m' == *lastchar || 'M' == *lastchar) {
+                *lastchar = '\0';
+                multit = 1024 * 1024;
+            }
+            else if ('k' == *lastchar || 'K' == *lastchar) {
+                *lastchar = '\0';
+                multit = 1024;
+            }
+            int_res = multit * atoi(buf);
         }
-        else if ('k' == *lastchar || 'K' == *lastchar) {
-            *lastchar = '\0';
-            multit = 1024;
-        }
-        int_res = atoi(buf);
+        else
+            int_res = def;
     }
-    else
-        int_res = def;

-    return int_res * multit;
+    return int_res;
 }

 double jk_map_get_double(jk_map_t *m, const char *name, double def)

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to