summaryrefslogtreecommitdiff
path: root/util.c
diff options
context:
space:
mode:
Diffstat (limited to 'util.c')
-rw-r--r--util.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/util.c b/util.c
index c003291007..873d3cb879 100644
--- a/util.c
+++ b/util.c
@@ -3115,9 +3115,13 @@ Perl_find_script(pTHX_ const char *scriptname, bool dosearch,
if (len == 2 && tmpbuf[0] == '.')
seen_dot = 1;
#endif
+#ifdef HAS_STRLCAT
+ (void)strlcpy(tmpbuf + len, scriptname, sizeof(tmpbuf) - len);
+#else
/* FIXME? Convert to memcpy by storing previous strlen(scriptname)
*/
(void)strcpy(tmpbuf + len, scriptname);
+#endif /* #ifdef HAS_STRLCAT */
#endif /* !VMS */
#ifdef SEARCH_EXTS
@@ -4290,7 +4294,11 @@ Perl_upg_version(pTHX_ SV *ver)
if ( SvNOK(ver) ) /* may get too much accuracy */
{
char tbuf[64];
- const STRLEN len = my_sprintf(tbuf,"%.9"NVgf, SvNVX(ver));
+#ifdef USE_SNPRINTF
+ const STRLEN len = snprintf(tbuf, sizeof(tbuf), "%.9"NVgf, SvNVX(ver));
+#else
+ const STRLEN len = my_sprintf(tbuf, "%.9"NVgf, SvNVX(ver));
+#endif /* #ifdef USE_SNPRINTF */
version = savepvn(tbuf, len);
}
#ifdef SvVOK