[Boost-bugs] [Boost C++ Libraries] #3085: Fixed-size buffers and strncpy

Subject: [Boost-bugs] [Boost C++ Libraries] #3085: Fixed-size buffers and strncpy
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2009-05-26 11:36:15


#3085: Fixed-size buffers and strncpy
----------------------------------+-----------------------------------------
 Reporter: olafvdspek_at_[hidden] | Owner: djowel
     Type: Bugs | Status: new
Milestone: Boost 1.40.0 | Component: spirit
  Version: Boost 1.38.0 | Severity: Problem
 Keywords: |
----------------------------------+-----------------------------------------
 Fixed-size buffers and strncpy really don't belong in an example of a
 Boost lib... ;)

 boost_1_39_0\libs\spirit\classic\example\fundamental\comments.cpp:
 {{{
 void actor_cpp (const char *pfirst, const char *plast)
 {
     cout << "Parsing C++-comment" <<endl;
     cout << "Matched (" << plast-pfirst << ") characters: ";

     char cbbuffer[128];

     strncpy(cbbuffer, pfirst, plast-pfirst);
     cbbuffer[plast-pfirst] = '\0';

     cout << "\"" << cbbuffer << "\"" << endl;
 }
 }}}

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/3085>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:00 UTC