Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 22 Feb 1998 22:44:52 +0100
From:      Ollivier Robert <roberto@keltia.freenix.fr>
To:        hackers@FreeBSD.ORG
Subject:   Re: Signal 11 problem
Message-ID:  <19980222224452.A2190@keltia.freenix.fr>
In-Reply-To: <Pine.BSF.3.96.980223040539.19496C-100000@pluto.cpe.ku.ac.th>; from Sunthiti Patchararungruang on Mon, Feb 23, 1998 at 04:12:05AM %2B0700
References:  <199802221942.LAA08014@dingo.cdrom.com> <Pine.BSF.3.96.980223040539.19496C-100000@pluto.cpe.ku.ac.th>

next in thread | previous in thread | raw e-mail | index | archive | help
According to Sunthiti Patchararungruang:
> 	Sorry about my useless example. Here is the real problem. I cut it
> from wu-ftpd 2.4. All variables are proved to be correct. I use
       ^^^^^^^^^^^
Thanks for giving us the real clue. See below.

> FreeBSD2.2.5.
> 
>         sprintf(msg, "%.24s %d %s %d %s %c %s %c %c %s ftp %d %s\n",
                                    ^^
>                 ctime(&curtime),
>                 xfertime,
>                 remotehost,
>                 byte_count,
                  ^^^^^^^^^^
Your problem is probably there and we tumbled on it a something like two
years ago :-) It is the "byte_count" thingy which is probably an "off_t"
(64 bits) but the sprintf format string want it as an int "%d".

That cause a difference in offsets between what it is in the stack and what 
the sprintf function retrieve from it based on the format string.

Change your format string to show "%qd" (or better "%qu") and watch your
program run.
-- 
Ollivier ROBERT -=- FreeBSD: The Power to Serve! -=- roberto@keltia.freenix.fr
FreeBSD keltia.freenix.fr 3.0-CURRENT #1: Sun Feb 22 00:44:29 CET 1998

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



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