bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug-gnulib] readtokens bug


From: Bruno Haible
Subject: [Bug-gnulib] readtokens bug
Date: Tue, 14 Jan 2003 13:38:21 +0100 (CET)

Hi Jim,

I made this patch. It avoids a crash on 64-bit platforms, when one of the
delimiters is a non-ASCII byte. ( remember (unsigned char) -5 = 0xFB but
(unsigned int) -5 = 0x00000000FFFFFFFB) )


2003-01-11  Bruno Haible  <address@hidden>

        * readtokens.c (readtoken): Cast character to 'unsigned char', not
        'unsigned int'.

diff -r -c3 --exclude=MODULES.html gnulib-cvs/lib/readtokens.c 
gnulib/lib/readtokens.c
*** gnulib-cvs/lib/readtokens.c 2001-12-09 23:39:02.000000000 +0100
--- gnulib/lib/readtokens.c     2003-01-11 16:56:13.000000000 +0100
***************
*** 1,5 ****
  /* readtokens.c  -- Functions for reading tokens from an input stream.
!    Copyright (C) 1990-1991, 1999, 2001 Jim Meyering.
  
     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
--- 1,5 ----
  /* readtokens.c  -- Functions for reading tokens from an input stream.
!    Copyright (C) 1990-1991, 1999, 2001, 2003 Jim Meyering.
  
     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
***************
*** 113,119 ****
        for (j = 0; j < sizeof (isdelim); j++)
        isdelim[j] = 0;
        for (t = delim; *t; t++)
!       isdelim[(unsigned int) *t] = 1;
      }
  
    p = tokenbuffer->buffer;
--- 113,119 ----
        for (j = 0; j < sizeof (isdelim); j++)
        isdelim[j] = 0;
        for (t = delim; *t; t++)
!       isdelim[(unsigned char) *t] = 1;
      }
  
    p = tokenbuffer->buffer;




reply via email to

[Prev in Thread] Current Thread [Next in Thread]