home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / bugs / 2bsd / 76 next >
Encoding:
Text File  |  1992-08-25  |  2.4 KB  |  109 lines

  1. Newsgroups: comp.bugs.2bsd
  2. Path: sparky!uunet!europa.asd.contel.com!awds.imsd.contel.com!wlbr!sms
  3. From: sms@WLV.IIPO.GTEGSC.COM (Steven M. Schultz)
  4. Subject: _doprnt %c bug  (#69)
  5. Message-ID: <1992Aug26.042220.29733@wlbr.iipo.gtegsc.com>
  6. Sender: news@wlbr.iipo.gtegsc.com (news)
  7. Nntp-Posting-Host: wlv.iipo.gtegsc.com
  8. Organization: GTE Government Systems
  9. Date: Wed, 26 Aug 92 04:22:20 GMT
  10. Lines: 97
  11.  
  12. Subject: _doprnt %c bug  (#69)
  13. Index:    lib/libc/pdp/stdio 2.11BSD
  14.  
  15. Description:
  16.     There is a serious bug in _doprnt's handling of %c.  Null characters
  17.     are ignored!  This causes a problem in 'telnet's terminal type
  18.     negotiations which need a null byte after the suboption byte.
  19.  
  20.     The %r command was also removed since it was undocumented and not
  21.     present in 4.3BSD (or later).  A side benefit is the saving of a few 
  22.     bytes of space.
  23.  
  24. Repeat-By:
  25.     Run the test program below.  If the output is not 3 then the bug
  26.     is present.
  27.  
  28.     ---------------------------cut here------------------------
  29.     char    buf[32];
  30.  
  31. main()
  32.     {
  33.     sprintf(buf, "%c%c%c%c%s%c%c", 0xff, 0xfa, 0x18, 0x00,
  34.         "VT100", 0xff, 0xf0);
  35.     printf("strlen = %d\n", strlen(buf));
  36.     }
  37.     ------------------------cut here-------------------------
  38.  
  39. Fix:
  40.     Apply the patch below and replace doprnt.o in /lib/libc.a and
  41.     /usr/lib/libc_p.a.  Save the patch below into /tmp/foo and:
  42.  
  43.         cd /usr/src/lib/libc/pdp/stdio
  44.         patch < /tmp/foo
  45.         make
  46.         ar /lib/libc.a doprnt.o
  47.         cd profiled
  48.         ar /usr/lib/libc.a doprnt.o
  49.         cd ..
  50.         ranlib /lib/libc.a /usr/lib/libc_p.a
  51.         make clean
  52. --------------------------cut here-------------------------------
  53. *** /usr/src/lib/libc/pdp/stdio/doprnt.s.old    Thu Dec 31 16:10:52 1987
  54. --- /usr/src/lib/libc/pdp/stdio/doprnt.s    Tue Aug 25 19:42:46 1992
  55. ***************
  56. *** 5,11 ****
  57.    */
  58.   
  59.   #ifdef LIBC_SCCS
  60. !     <@(#)doprnt.s    5.4 (Berkeley) 1/25/87\0>
  61.       .even
  62.   #endif LIBC_SCCS
  63.   
  64. --- 5,12 ----
  65.    */
  66.   
  67.   #ifdef LIBC_SCCS
  68. ! /*    <@(#)doprnt.s    5.4 (Berkeley) 1/25/87\0> */
  69. !     <@(#)doprnt.s    5.5 (GTE) 8/25/92\0>
  70.       .even
  71.   #endif LIBC_SCCS
  72.   
  73. ***************
  74. *** 34,40 ****
  75.       longorunsg;    'l
  76.       longorunsg;    'L
  77.       unsigned;    'u
  78. -     remote;        'r
  79.       long;        'D
  80.       loct;        'O
  81.       lhex;        'X
  82. --- 35,40 ----
  83. ***************
  84. *** 244,251 ****
  85.   charac:
  86.       mov    $' ,zfill(r5)
  87.       mov    (r4)+,r0
  88. -     bic    $!377,r0
  89. -     beq    prbuf
  90.       movb    r0,(r3)+
  91.       br    prbuf
  92.   
  93. --- 244,249 ----
  94. ***************
  95. *** 282,293 ****
  96.   1:
  97.       mov    pc,r2
  98.       jsr    pc,pscien
  99. -     br    prbuf
  100. - remote:
  101. -     mov    (r4)+,r4
  102. -     mov    (r4)+,formp(r5)
  103. -     jmp    loop
  104.   
  105.   prbuf:
  106.       mov    sp,r2
  107. --- 280,285 ----
  108.