Skip to content
  • Sylvain Joubert's avatar
    ccmake: Fix crash with cache entries almost the size of the window · b4ef7fba
    Sylvain Joubert authored
    The previous code:
    
    if (curFieldLen < width) {
      ...
      strncpy(bar + curFieldLen + 2, help, width - curFieldLen - 2);
    
    was not correctly guarded against cache entries whose size were exactly
    1 or 2 characters short of the window size.
    "if (curFieldLen - 2 < width)" would have prevented a copy of
    negative/max_int characters and a subsequent crash.
    
    The whole method was modernized with std::string instead of char*
    b4ef7fba