Changeset b9cb41b for functions.c


Ignore:
Timestamp:
Dec 6, 2008, 11:25:33 PM (12 years ago)
Author:
Anders Kaseorg <andersk@mit.edu>
Branches:
master, debian, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
Children:
56d0189
Parents:
49a8434
git-author:
Anders Kaseorg <andersk@mit.edu> (12/06/08 23:20:19)
git-committer:
Anders Kaseorg <andersk@mit.edu> (12/06/08 23:25:33)
Message:
Replace questionable sprintf(buf, "%s...", buf, ...) pattern, which is
broken by -D_FORTIFY_SOURCE.

perl -pe 's/(sprintf\s*\(\s*([^,]*))(\s*,\s*")%s([^"]*"\s*,)\s*\2\s*,/\1 + strlen(\2)\3\4/g'
File:
1 edited

Legend:

Unmodified
Added
Removed
  • functions.c

    r49a8434 rb9cb41b  
    16421642        /* fix this */
    16431643        sprintf(buff, "  Checkd Ath: %i\n", n->z_checked_auth);
    1644         sprintf(buff, "%s  Multi notc: %s\n", buff, n->z_multinotice);
    1645         sprintf(buff, "%s  Num other : %i\n", buff, n->z_num_other_fields);
    1646         sprintf(buff, "%s  Msg Len   : %i\n", buff, n->z_message_len);
     1644        sprintf(buff + strlen(buff), "  Multi notc: %s\n", n->z_multinotice);
     1645        sprintf(buff + strlen(buff), "  Num other : %i\n", n->z_num_other_fields);
     1646        sprintf(buff + strlen(buff), "  Msg Len   : %i\n", n->z_message_len);
    16471647        owl_fmtext_append_normal(&fm, buff);
    16481648       
     
    25892589  sprintf(argbuff, "class ^(un)*%s(\\.d)*$", tmpclass);
    25902590  if (tmpinstance) {
    2591     sprintf(argbuff, "%s and ( instance ^(un)*%s(\\.d)*$ )", argbuff, tmpinstance);
     2591    sprintf(argbuff + strlen(argbuff), " and ( instance ^(un)*%s(\\.d)*$ )", tmpinstance);
    25922592  }
    25932593  owl_free(tmpclass);
     
    29992999    owl_text_tr(quoted, '\'', '.');
    30003000    owl_text_tr(quoted, '"', '.');
    3001     sprintf(buff, "%s ^(un)*%s(\\.d)*$", buff, quoted);
     3001    sprintf(buff + strlen(buff), " ^(un)*%s(\\.d)*$", quoted);
    30023002    owl_free(quoted);
    30033003  }
     
    30093009    owl_text_tr(quoted, '\'', '.');
    30103010    owl_text_tr(quoted, '"', '.');
    3011     sprintf(buff, "%s and instance ^(un)*%s(\\.d)*$", buff, quoted);
     3011    sprintf(buff + strlen(buff), " and instance ^(un)*%s(\\.d)*$", quoted);
    30123012    owl_free(quoted);
    30133013  }
     
    30173017    owl_text_tr(quoted, '\'', '.');
    30183018    owl_text_tr(quoted, '"', '.');
    3019     sprintf(buff, "%s and recipient ^%s$", buff, quoted);
     3019    sprintf(buff + strlen(buff), " and recipient ^%s$", quoted);
    30203020    owl_free(quoted);
    30213021  }
Note: See TracChangeset for help on using the changeset viewer.