Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 25 Aug 2003 07:01:10 +0100 (BST)
From:      Mark Valentine <mark@thuvia.org>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   bin/55947: printf(1) mishandles \0
Message-ID:  <200308250601.h7P61Avj054557@dotar.thuvia.org>
Resent-Message-ID: <200308250610.h7P6A3Dc086450@freefall.freebsd.org>

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

>Number:         55947
>Category:       bin
>Synopsis:       printf(1) mishandles \0
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Aug 24 23:10:03 PDT 2003
>Closed-Date:
>Last-Modified:
>Originator:     Mark Valentine
>Release:        FreeBSD 4.8-STABLE i386
>Organization:
>Environment:
System: FreeBSD dotar.thuvia.org 4.8-STABLE FreeBSD 4.8-STABLE #6: Wed Jun 11 15:04:41 BST 2003 root@dotar.thuvia.org:/usr/obj/usr/src/sys/DOTAR i386

>Description:
printf(1) doesn't handle the sequence \0 correctly in format strings:

  $ printf 'foo\0bar' | hd
  00000000  66 6f 6f                                          |foo|
  00000003

The expected result is:

  $ printf 'foo\0bar' | hd
  00000000  66 6f 6f 00 62 61 72                              |foo.bar|
  00000007
>How-To-Repeat:
>Fix:
Borrow code from NetBSD's printf(1)...
>Release-Note:
>Audit-Trail:
>Unformatted:



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