Changeset 5547211b


Ignore:
Timestamp:
Dec 13, 2008, 5:32:06 PM (12 years ago)
Author:
Nelson Elhage <nelhage@mit.edu>
Children:
1c014eec
Parents:
44fc93b
git-author:
Anders Kaseorg <andersk@mit.edu> (12/06/08 23:20:19)
git-committer:
Nelson Elhage <nelhage@mit.edu> (12/13/08 17:32:06)
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'
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • functions.c

    r44fc93b r5547211b  
    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  }
  • global.c

    r2b237308 r5547211b  
    570570  strcpy(g->startupargs, "");
    571571  for (i=0; i<argc; i++) {
    572     sprintf(g->startupargs, "%s%s ", g->startupargs, argv[i]);
     572    sprintf(g->startupargs + strlen(g->startupargs), "%s ", argv[i]);
    573573  }
    574574  g->startupargs[strlen(g->startupargs)-1]='\0';
  • zcrypt.c

    r34509d5 r5547211b  
    375375
    376376    for (i = 0; i < 8; i++) {
    377       sprintf(out, "%s%c", out, ((output[i] & 0xf0) >> 4) + BASE_CODE);
    378       sprintf(out, "%s%c", out, (output[i] & 0x0f)        + BASE_CODE);
     377      sprintf(out + strlen(out), "%c", ((output[i] & 0xf0) >> 4) + BASE_CODE);
     378      sprintf(out + strlen(out), "%c", (output[i] & 0x0f)        + BASE_CODE);
    379379    }
    380380
  • zephyr.c

    r451db9e r5547211b  
    814814    ZGetLocations(&locations,&one);
    815815    myuser=short_zuser(user);
    816     sprintf(out, "%s%s: %s\t%s\t%s\n", out, myuser,
     816    sprintf(out + strlen(out), "%s: %s\t%s\t%s\n", myuser,
    817817            locations.host ? locations.host : "?",
    818818            locations.tty ? locations.tty : "?",
  • zwrite.c

    r3f3ee61 r5547211b  
    231231    for (i=0; i<j; i++) {
    232232      if (strcmp(z->realm, "")) {
    233         sprintf(toline, "%s%s@%s ", toline, (char *) owl_list_get_element(&(z->recips), i), z->realm);
     233        sprintf(toline + strlen(toline), "%s@%s ", (char *) owl_list_get_element(&(z->recips), i), z->realm);
    234234      } else {
    235         sprintf(toline, "%s%s ", toline, (char *) owl_list_get_element(&(z->recips), i));
     235        sprintf(toline + strlen(toline), "%s ", (char *) owl_list_get_element(&(z->recips), i));
    236236      }
    237237    }
Note: See TracChangeset for help on using the changeset viewer.