Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 19 Nov 1999 16:16:07 -0800 (PST)
From:      cynbe@muq.org
To:        freebsd-gnats-submit@freebsd.org
Subject:   misc/15002: coredump in sprintf with long long args
Message-ID:  <19991120001607.C165215127@hub.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         15002
>Category:       misc
>Synopsis:       coredump in sprintf with long long args
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Nov 19 16:20:00 PST 1999
>Closed-Date:
>Last-Modified:
>Originator:     Cynbe ru Taren
>Release:        FreeBSD 2.2.7-RELEASE g  on intel.
>Organization:
muq.org
>Environment:
(I do not have access to the machine in question.)
>Description:
A user reported Muq (a program I maintain) coredumps on his freebsd
box.  Reproduced the problem using the following simple test program.
(I.e., emailed it to him and he reports that it dumps core also.)
I am unable to localize the problem further.
>How-To-Repeat:
/* 99Nov19CrT Test program for Muq problem */
/* on     FreeBSD 2.2.7-RELEASE g          */
/* using  gcc 2.7.2.1 Intel,               */
/* reported by Laurent Bossavit morendil@mmanian.com */
/*                                         */
/* Compile and test just by doing          */
/*                                         */
/* gcc x.c -o x                            */
/* ./x                                     */
#include <stdio.h>
int
main(
    int    argc,
    char** argv
) {
    long long sys_Ip0      = (long long) 205;
    long long sys_Ip1      = (long long) 178;
    long long sys_Ip2      = (long long) 16;
    long long sys_Ip3      = (long long) 44;
    long long sys_Muq_Port = (long long) 30023;
    unsigned char jobbuf[32];
    unsigned char nambuf[32];
    unsigned char datbuf[32];
    unsigned char buffer[8192*2];
    strcpy( datbuf, "1999/11/19/13:15:22.984" );
    strcpy( jobbuf, ""                        );
    strcpy( nambuf, ""                        );
    /* Write log line prefix: */
    sprintf(
        buffer,
        "date:%s muq:%03lld.%03lld.%03lld.%03lld:%05lld job:%16s user:%-16s msg: ",
        datbuf,
        sys_Ip0,
        sys_Ip1,
        sys_Ip2,
        sys_Ip3,
        sys_Muq_Port,
        jobbuf,
        nambuf
    );
    printf("buffer = '%s'\n", buffer );
    exit(0);
}

>Fix:
Given code works fine on linux:  If FreeBSD is switching to
glibc, that will presumably resolve the problem.

>Release-Note:
>Audit-Trail:
>Unformatted:


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19991120001607.C165215127>