Changeset 1075


Ignore:
Timestamp:
Jul 30, 2003, 11:26:42 PM (17 years ago)
Author:
luba
Message:
  • check for "Size limit exceeded" is added
File:
1 edited

Legend:

Unmodified
Added
Removed
  • to-imperative/trunk/library/String/string.cc

    r1021 r1075  
    1818
    1919  Term* p = e_Sourse.get_first();
     20 
     21  size_t len = 0;
     22  size_t length = 0;
     23
    2024  WString s;
     25  WString str;
    2126 
    2227  for (p = e_Sourse.get_first(); p < e_Sourse.get_last(); p++) {
    23      s = s + WString(*p);
     28    str = WString(*p);
     29    length = str.get_length();
     30    if (len > SIZE_MAX - length)
     31      RF_LIB_ERROR("Size limit exceeded");
     32    else
     33      len += length;
     34
     35     s = s + str;
    2436  }
    2537
Note: See TracChangeset for help on using the changeset viewer.