From yar@FreeBSD.org  Sun Oct 14 09:30:36 2007
Return-Path: <yar@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id D7FE116A418;
	Sun, 14 Oct 2007 09:30:36 +0000 (UTC)
	(envelope-from yar@FreeBSD.org)
Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28])
	by mx1.freebsd.org (Postfix) with ESMTP id BEEAB13C43E;
	Sun, 14 Oct 2007 09:30:36 +0000 (UTC)
	(envelope-from yar@FreeBSD.org)
Received: from freefall.freebsd.org (yar@localhost [127.0.0.1])
	by freefall.freebsd.org (8.14.1/8.14.1) with ESMTP id l9E9UagC092214;
	Sun, 14 Oct 2007 09:30:36 GMT
	(envelope-from yar@freefall.freebsd.org)
Received: (from yar@localhost)
	by freefall.freebsd.org (8.14.1/8.14.1/Submit) id l9E9UamK092213;
	Sun, 14 Oct 2007 09:30:36 GMT
	(envelope-from yar)
Message-Id: <200710140930.l9E9UamK092213@freefall.freebsd.org>
Date: Sun, 14 Oct 2007 09:30:36 GMT
From: Yar Tikhiy <yar@comp.chem.msu.su>
To: FreeBSD-gnats-submit@FreeBSD.org
Cc: rrs@FreeBSD.org
Subject: Incorrect format strings in netstat/sctp.c
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         117175
>Category:       bin
>Synopsis:       Incorrect format strings in netstat/sctp.c
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    rrs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Oct 14 09:40:00 UTC 2007
>Closed-Date:    Sat Jan 26 01:59:42 UTC 2008
>Last-Modified:  Sat Jan 26 01:59:42 UTC 2008
>Originator:     Yar Tikhiy
>Release:        FreeBSD 7.0-CURRENT i386
>Organization:
none
>Environment:
	CURRENT, 7-STABLE.

	
>Description:
	src/usr.bin/netstat/sctp.c tries to printf grammatically
	correct phrases by guessing singular or plural for counter
	names.  However, some of the format strings are funny.
	Presumably they were mechanically generated and were not
	proofed afterwards.

>How-To-Repeat:

Note gems like "ho%st" or "%sctp" in what follows:

yar@jujik:/usr/src/usr.bin/netstat$grep -n "%s[a-z]" sctp.c
552:    p(sctps_recvivalkeyid, "\t\t%ju invalid %secret ids received\n");
554:    p(sctps_recvexpress, "\t\t%ju fa%st path receives all one chunk\n");
555:    p(sctps_recvexpressm, "\t\t%ju fa%st path multi-part data\n");
563:    p(sctps_sendretransdata, "\t\t%ju retran%smitted DATA chunks\n");
564:    p(sctps_sendfastretrans, "\t\t%ju fa%st retransmitted DATA chunks\n");
577:    p(sctps_pdrpfehos, "\t\t%ju from end ho%st\n");
580:    p(sctps_pdrpbwrpt, "\t\t%ju non-endho%st, bandwidth rep only\n");
583:    p(sctps_pdrppdbrk, "\t\t%ju where proce%ss_chunk_drop said break\n");
585:    p(sctps_pdrpdnfnd, "\t\t%ju attempt rever%se TSN lookup\n");
586:    p(sctps_pdrpdiwnp, "\t\t%ju e-ho%st confirms zero-rwnd\n");
599:    p(sctps_timosack, "\t\t%ju %sack timers fired\n");
600:    p(sctps_timoshutdown, "\t\t%ju %shutdown timers fired\n");
606:    p(sctps_timoshutdownack, "\t\t%ju %shutdown ack timers fired\n");
607:    p(sctps_timoshutdownguard, "\t\t%ju %shutdown guard timers fired\n");
608:    p(sctps_timostrmrst, "\t\t%ju %stream reset timers fired\n");
612:    p(sctps_timoassockill, "\t\t%ju a%soc free timers expired\n");
619:    p(sctps_earlyfrstart, "\t%ju TODO:%sctps_earlyfrstart\n");
621:    p(sctps_earlyfrmrkretrans, "\t%ju TODO:%sctps_earlyfrmrkretrans\n");
622:    p(sctps_earlyfrstpout, "\t%ju TODO:%sctps_earlyfrstpout\n");
623:    p(sctps_earlyfrstpidsck1, "\t%ju TODO:%sctps_earlyfrstpidsck1\n");
624:    p(sctps_earlyfrstpidsck2, "\t%ju TODO:%sctps_earlyfrstpidsck2\n");
625:    p(sctps_earlyfrstpidsck3, "\t%ju TODO:%sctps_earlyfrstpidsck3\n");
626:    p(sctps_earlyfrstpidsck4, "\t%ju TODO:%sctps_earlyfrstpidsck4\n");
627:    p(sctps_earlyfrstrid, "\t%ju TODO:%sctps_earlyfrstrid\n");
628:    p(sctps_earlyfrstrout, "\t%ju TODO:%sctps_earlyfrstrout\n");
629:    p(sctps_earlyfrstrtmr, "\t%ju TODO:%sctps_earlyfrstrtmr\n");
635:    p(sctps_hdrops, "\t%ju packet %shorter than header\n");
636:    p(sctps_badsum, "\t%ju check%sum error\n");
644:    p(sctps_markedretrans, "\t%ju TODO:%sctps_markedretrans\n");
646:    p(sctps_naglesent, "\t%ju RFC813 allowed %sending\n");
648:    p(sctps_maxburstqueued, "\t%ju max bur%st dosn't allow sending\n");
662:    p(sctps_vtagexpress, "\t%ju u%sed express lookup via vtag\n");
663:    p(sctps_vtagbogus, "\t%ju colli%sion in express lookup.\n");
668:    p(sctps_wu_sacks_sent, "\t%ju window update only %sacks sent\n");
669:    p(sctps_sends_with_flags, "\t%ju %sends with sinfo_flags !=0\n");
670:    p(sctps_sends_with_unord, "\t%ju unordered %sends\n");
671:    p(sctps_sends_with_eof, "\t%ju %sends with EOF flag set\n");
672:    p(sctps_sends_with_abort, "\t%ju %sends with ABORT flag set\n");
678:    p(sctps_cached_strmoq, "\t%ju cached %stream oq's used\n");
679:    p(sctps_left_abandon, "\t%ju unread me%ssage abandonded by close\n");
680:    p(sctps_send_burst_avoid, "\t%ju send bur%st avoidance, already "
683:        "max bur%st inflight to net\n");

>Fix:

	Move the %s's to where plural suffixes actually should be
	in the phrases.
>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->rrs 
Responsible-Changed-By: yar 
Responsible-Changed-When: Sun Oct 14 09:41:46 UTC 2007 
Responsible-Changed-Why:  
Over to Randall, who keeps contact with the actual author of the code 
in question. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=117175 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: bin/117175: commit references a PR
Date: Wed, 17 Oct 2007 10:16:26 +0000 (UTC)

 rrs         2007-10-17 10:16:20 UTC
 
   FreeBSD src repository
 
   Modified files:
     usr.bin/netstat      sctp.c 
   Log:
   Fix incorrect string formats for netstat/s
   
   PR:             117175
   Obtained from:  Weongyo Jeong (weongyo.jeong@gmail.com)
   MFC after:      1 week
   
   Revision  Changes    Path
   1.8       +48 -48    src/usr.bin/netstat/sctp.c
 _______________________________________________
 cvs-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/cvs-all
 To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
 
State-Changed-From-To: open->closed 
State-Changed-By: linimon 
State-Changed-When: Fri Jan 25 23:28:37 UTC 2008 
State-Changed-Why:  
Fixed in rev 1.8 of sctp.c. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=117175 
State-Changed-From-To: closed->patched 
State-Changed-By: linimon 
State-Changed-When: Fri Jan 25 23:30:15 UTC 2008 
State-Changed-Why:  
Closed by mistake; this needs to be MFCed. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=117175 
State-Changed-From-To: patched->closed 
State-Changed-By: yar 
State-Changed-When: Sat Jan 26 01:58:51 UTC 2008 
State-Changed-Why:  
This has been MFCed in sctp.c rev. 1.7.2.1. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=117175 
>Unformatted:
