Text   |  XML   |  ReML   |   Visible Warnings:

Buffer Underrun  at prefs.c:936

No properties have been set. | edit properties
Jump to warning location ↓ warning details...
Show Events | Options

put_string_list

(/home/sate/Testcases/c/cve/wireshark-1.2.0/epan/prefs.c)expand/collapse
Show more  
 898  static gchar *
 899  put_string_list(GList *sl)
 900  {
 901    static gchar  pref_str[MAX_FMT_PREF_LEN] = "";
 902    GList        *clp = g_list_first(sl);
 903    gchar        *str;
 904    size_t        cur_pos = 0, cur_len = 0;
 905    gchar        *quoted_str;
 906    size_t        str_len;
 907    gchar        *strp, *quoted_strp, c;
 908    size_t        fmt_len;
 909   
 910    while (clp) {
 911      str = clp->data;
 912   
 913      /* Allocate a buffer big enough to hold the entire string, with each
 914         character quoted (that's the worst case).  */
 915      str_len = strlen(str);
 916      quoted_str = g_malloc(str_len*2 + 1);
 917   
 918      /* Now quote any " or \ characters in it. */
 919      strp = str;
 920      quoted_strp = quoted_str;
 921      while ((c = *strp++) != '\0') {
 922        if (c == '"' || c == '\\') {
 923          /* It has to be backslash-quoted.  */
 924          *quoted_strp++ = '\\';
 925        }
 926        *quoted_strp++ = c;
 927      }
 928      *quoted_strp = '\0';
 929   
 930      fmt_len = strlen(quoted_str) + 4;
 931      if ((fmt_len + cur_len) < (MAX_FMT_PREF_LEN - 1)) {
 932        if ((fmt_len + cur_pos) > MAX_FMT_PREF_LINE_LEN) {
 933          /* Wrap the line.  */
 934          cur_len--;
 935          cur_pos = 0;
 936          pref_str[cur_len] = '\n'; cur_len++;
Show more  




Change Warning 3492.29656 : Buffer Underrun

Priority:
State:
Finding:
Owner:
Note: