#41077: mod_jk fails with "source and destination buffer overlap" on Maverick ----------------------+-------------------------------- Reporter: girgen@… | Owner: macports-tickets@… Type: defect | Status: new Priority: High | Milestone: Component: ports | Version: 2.2.1 Keywords: | Port: mod_jk ----------------------+-------------------------------- Apple appears to have made strcpy() enforce that the src and dest buffers may not overlap. This makes mod_jk fail. There is a patch upstreams alread. [https://issues.apache.org/bugzilla/show_bug.cgi?id=55696] This patch to the macport just uses the referred patch. Also, set JAVA_HOME using /usr/libexec/java_home for convenience. {{{ --- Portfile.orig 2013-10-30 12:40:54.000000000 +0100 +++ Portfile 2013-10-30 12:43:02.000000000 +0100 @@ -4,6 +4,7 @@ name mod_jk version 1.2.27 +revision 1 categories www java license Apache-2 BSD @@ -39,7 +40,7 @@ if { [llength [array get env "JAVA_HOME"]] > 0 } { set javahome $env(JAVA_HOME) } else { - set javahome "" + set javahome [exec /usr/libexec/java_home] } if { ![file isdirectory ${javahome}] } { if { ${os.platform} == "darwin" } { @@ -72,6 +73,7 @@ } } +patchfiles-append jk_map.c.patch if {[variant_isset universal]} { patchfiles-append configure_universal.patch post-configure { --- /dev/null 2013-10-30 12:43:06.000000000 +0100 +++ files/jk_map.c.patch 2013-10-30 12:42:02.000000000 +0100 @@ -0,0 +1,62 @@ +Index: common/jk_map.c +=================================================================== +--- common/jk_map.c (revision 1535519) ++++ 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) }}} -- Ticket URL: <https://trac.macports.org/ticket/41077> MacPorts <http://www.macports.org/> Ports system for OS X