Re: [Lit.] Buffer overruns

From: Bryan Olson (fakeaddress_at_nowhere.org)
Date: 01/26/05


Date: Wed, 26 Jan 2005 02:46:44 GMT

David Wagner wrote:
> Bryan Olson wrote:
>
>> char buff[BUFSIZ];
>> size_t count;
>> do {
>> count = fread(buff, 1, sizeof(buff), stdin);
>> upstring(buff, count);
>> count = fwrite(buff, 1, count, stdout);
>> } while (count == sizeof(buff));
>
>
> Does fwrite() guarantee to write exactly 'count' bytes, or could
> it (like write()) possibly write less?

Unless an error occurs, yes, which is the behavior I want.

-- 
--Bryan


Relevant Pages

  • Re: [Lit.] Buffer overruns
    ... > David Wagner wrote: ... >> Does fwrite() guarantee to write exactly 'count' bytes, ... the broken "Reply" link at the bottom of the article. ...
    (sci.crypt)
  • Re: [Lit.] Buffer overruns
    ... David Wagner wrote: ... > Does fwriteguarantee to write exactly 'count' bytes, ... > need another loop around fwrite(). ... fwrite writes all the specified data up to the first error. ...
    (sci.crypt)
  • Re: Schneiers "Helix" cipher is remarkably similar to the "generic feistel cipher&qu
    ... Bryan Olson wrote: ... > David Wagner showed to be trivially weak several hours later. ... multipermutation hash mixer routine of Bob Jenkins. ...
    (sci.crypt)
  • Re: [Lit.] Buffer overruns
    ... Bryan Olson wrote: ... > David Wagner wrote: ... on reflection you're right about that. ... seeing this subthread. ...
    (sci.crypt)