title: Possible to combine two strings, each with length of PATH_MAX?
body: <p>I want to build a string containing a filename including the full path. My approach on that is as follows:</p>
  <pre><code>#include &lt;limits.h&gt;
  #include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  
  int main( int argc, char *argv[] ) {
  
      char
          fullpath[PATH_MAX],
          workdir[PATH_MAX];
        
      sprintf( workdir, &quot;workdir/&quot; );
      sprintf( fullpath, &quot;%sfilename.dat&quot;, workdir);
      printf( &quot;fullpath = %s\n&quot;, fullpath );
    
      return EXIT_SUCCESS;
    
  }
  </code></pre>
  <p>When compiling, I get the following warning</p>
  <pre><code>warning: ‘filename.dat’ directive writing 12 bytes into a region of size between 1 and 4096 [-Wformat-overflow=]
  sprintf( fullpath, &quot;%sfilename.dat&quot;, workdir);
                        ^~~~~~~~~~~~
  
  note: ‘sprintf’ output between 13 and 4108 bytes into a destination of size 4096
  sprintf( fullpath, &quot;%sfilename.dat&quot;, workdir);
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  </code></pre>
  <p>Do I understand that warning (and the note) correctly, that it might happen that I combine two strings, each with <code>PATH_MAX</code> which would then result in problems?</p>
  <p>And does that mean I should not combine a string with PATH_MAX with any other string? (At least not in that simplified way I am doing it)</p>