This patch will temporarily appease tinderbox.perl.org, but it has
three medium-term problems:

1.  Configure.pl doesn't figure out HAS_SNPRINTF yet.
2.  Systems without snprintf() are subject to buffer overflows.
3.  The format strings may not be correct.  We need Configure.pl
    to figure out the correct format strings for INTVALs and NUMVALs.

diff -r -u parrot/classes/perlint.pmc parrot-andy/classes/perlint.pmc
--- parrot/classes/perlint.pmc  Fri Nov 30 14:58:38 2001
+++ parrot-andy/classes/perlint.pmc     Fri Nov 30 15:01:45 2001
@@ -55,7 +55,11 @@
     STRING* get_string () {
        char* buff = mem_sys_allocate(80);
        STRING* s;
+#ifdef HAS_SNPRINTF
        snprintf(buff,80,"%d",SELF->cache.int_val);
+#else
+       sprintf(buff,"%d",SELF->cache.int_val);  /* XXX buffer overflow! */
+#endif
        s = string_make(INTERP,buff,strlen(buff),NULL,0,NULL);
        free(buff);
        return s;
diff -r -u parrot/classes/perlnum.pmc parrot-andy/classes/perlnum.pmc
--- parrot/classes/perlnum.pmc  Fri Nov 30 14:58:38 2001
+++ parrot-andy/classes/perlnum.pmc     Fri Nov 30 15:02:16 2001
@@ -55,7 +55,11 @@
     STRING* get_string () {
        char* buff = mem_sys_allocate(80);
        STRING* s;
+#ifdef HAS_SNPRINTF
        snprintf(buff,80,"%f",SELF->cache.num_val);
+#else
+       sprintf(buff,"%f",SELF->cache.num_val); /* XXX buffer overflow! */
+#endif
        s = string_make(INTERP,buff,strlen(buff),NULL,0,NULL);
        free(buff);
        return s;

-- 
    Andy Dougherty              [EMAIL PROTECTED]
    Dept. of Physics
    Lafayette College, Easton PA 18042

Reply via email to