Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #61663

Re: Method other than strlen to check for truncation with fgets?

From Lőrinczy Zsigmond <nospam@for.me>
Newsgroups comp.lang.c
Subject Re: Method other than strlen to check for truncation with fgets?
Date 2015-05-07 07:04 +0200
Organization Aioe.org NNTP Server
Message-ID <mieros$th2$1@speranza.aioe.org> (permalink)
References <midqe0$62n$1@dont-email.me>

Show all headers | View raw


On 2015.05.06. 21:35, mathog wrote:
> If fgets reads a line larger than the buffer then the
> buffer will end with "...\0" instead of the usual
> "...\n\0".   This is usually handled something like:

The input might contain \0 so this method is unreliable. Use getline(3).

Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Method other than strlen to check for truncation with fgets? mathog <dmathog@gmail.com> - 2015-05-06 12:35 -0700
  Re: Method other than strlen to check for truncation with fgets? Barry Schwarz <schwarzb@dqel.com> - 2015-05-06 15:14 -0700
    Re: Method other than strlen to check for truncation with fgets? mathog <dmathog@gmail.com> - 2015-05-06 16:14 -0700
      Re: Method other than strlen to check for truncation with fgets? Barry Schwarz <schwarzb@dqel.com> - 2015-05-06 17:51 -0700
      Re: Method other than strlen to check for truncation with fgets? Tim Rentsch <txr@alumni.caltech.edu> - 2015-05-06 18:23 -0700
        Re: Method other than strlen to check for truncation with fgets? mathog <dmathog@gmail.com> - 2015-05-07 10:07 -0700
          Re: Method other than strlen to check for truncation with fgets? Tim Rentsch <txr@alumni.caltech.edu> - 2015-05-07 16:06 -0700
  Re: Method other than strlen to check for truncation with fgets? James Kuyper <jameskuyper@verizon.net> - 2015-05-06 22:20 -0400
    Re: Method other than strlen to check for truncation with fgets? mathog <dmathog@gmail.com> - 2015-05-07 10:29 -0700
      Re: Method other than strlen to check for truncation with fgets? James Kuyper <jameskuyper@verizon.net> - 2015-05-07 14:09 -0400
        Re: Method other than strlen to check for truncation with fgets? mathog <dmathog@gmail.com> - 2015-05-07 12:48 -0700
          Re: Method other than strlen to check for truncation with fgets? James Kuyper <jameskuyper@verizon.net> - 2015-05-07 17:01 -0400
            Re: Method other than strlen to check for truncation with fgets? mathog <dmathog@gmail.com> - 2015-05-08 10:59 -0700
              Re: Method other than strlen to check for truncation with fgets? James Kuyper <jameskuyper@verizon.net> - 2015-05-08 14:48 -0400
              Re: Method other than strlen to check for truncation with fgets? glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2015-05-08 18:37 +0000
                Re: Method other than strlen to check for truncation with fgets? James Kuyper <jameskuyper@verizon.net> - 2015-05-08 15:06 -0400
  Re: Method other than strlen to check for truncation with fgets? Lőrinczy Zsigmond <nospam@for.me> - 2015-05-07 07:04 +0200
    Re: Method other than strlen to check for truncation with fgets? Richard Heathfield <rjh@cpax.org.uk> - 2015-05-07 06:52 +0100
      Re: Method other than strlen to check for truncation with fgets? Lőrinczy Zsigmond <zsiga@nospam.for.me> - 2015-05-07 09:58 +0200
        Re: Method other than strlen to check for truncation with fgets? Stephen Sprunk <stephen@sprunk.org> - 2015-05-07 09:12 -0500
        Re: Method other than strlen to check for truncation with fgets? Keith Thompson <kst-u@mib.org> - 2015-05-07 08:51 -0700
          Re: Method other than strlen to check for truncation with fgets? Lőrinczy Zsigmond <zsiga@nospam.for.me> - 2015-05-07 19:09 +0200
            Re: Method other than strlen to check for truncation with fgets? James Kuyper <jameskuyper@verizon.net> - 2015-05-07 14:15 -0400
    Re: Method other than strlen to check for truncation with fgets? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-05-07 11:31 +0100
      Re: Method other than strlen to check for truncation with fgets? Lőrinczy Zsigmond <zsiga@nospam.for.me> - 2015-05-07 15:41 +0200
        Re: Method other than strlen to check for truncation with fgets? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-05-08 02:44 +0100
          Re: Method other than strlen to check for truncation with fgets? James Kuyper <jameskuyper@verizon.net> - 2015-05-07 23:24 -0400
            Re: Method other than strlen to check for truncation with fgets? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-05-08 04:41 +0100
      Re: Method other than strlen to check for truncation with fgets? Keith Thompson <kst-u@mib.org> - 2015-05-07 08:49 -0700
        Re: Method other than strlen to check for truncation with fgets? James Kuyper <jameskuyper@verizon.net> - 2015-05-07 12:19 -0400
        Re: Method other than strlen to check for truncation with fgets? glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2015-05-07 18:08 +0000
    Re: Method other than strlen to check for truncation with fgets? James Kuyper <jameskuyper@verizon.net> - 2015-05-07 12:19 -0400
      Re: Method other than strlen to check for truncation with fgets? mathog <dmathog@gmail.com> - 2015-05-07 09:57 -0700
  Re: Method other than strlen to check for truncation with fgets? Siri Cruz <chine.bleu@yahoo.com> - 2015-05-07 11:31 -0700
    Re: Method other than strlen to check for truncation with fgets? Keith Thompson <kst-u@mib.org> - 2015-05-07 12:00 -0700
      Re: Method other than strlen to check for truncation with fgets? Siri Cruz <chine.bleu@yahoo.com> - 2015-05-07 12:44 -0700
        Re: Method other than strlen to check for truncation with fgets? Keith Thompson <kst-u@mib.org> - 2015-05-07 14:03 -0700
          Re: Method other than strlen to check for truncation with fgets? Siri Cruz <chine.bleu@yahoo.com> - 2015-05-07 15:28 -0700

csiph-web