~ubuntu-branches/debian/stretch/alpine/stretch

« back to all changes in this revision

Viewing changes to pith/send.c

  • Committer: Bazaar Package Importer
  • Author(s): Asheesh Laroia
  • Date: 2010-10-03 15:31:55 UTC
  • mfrom: (1.1.8 upstream)
  • Revision ID: james.westby@ubuntu.com-20101003153155-2exypc96j1e8tw0p
Tags: 2.02-1
* New upstream release, based on re-alpine project
* Updated debian/copyright to reflect this fact
* re-alpine removed the non-free from the tarball, so now
  we do not repack the upstream tarball. (Yay!)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#if !defined(lint) && !defined(DOS)
2
 
static char rcsid[] = "$Id: send.c 1125 2008-08-06 18:25:58Z mikes@u.washington.edu $";
 
2
static char rcsid[] = "$Id: send.c 1204 2009-02-02 19:54:23Z hubert@u.washington.edu $";
3
3
#endif
4
4
 
5
5
/*
2216
2216
 
2217
2217
        if(sz){
2218
2218
            int i;
2219
 
            char *p;
 
2219
            char *pstart, *pend;
2220
2220
 
2221
2221
            for(i = 0, pf = header->local; i != N_OURHDRS; i++, pf = pf->next)
2222
2222
              ;
2223
2223
 
2224
2224
            pf->writehdr  = 1;
2225
2225
            pf->localcopy = 1;
2226
 
            pf->textbuf = (char *) fs_get(sz);
 
2226
            pf->textbuf = pstart = pend = (char *) fs_get(sz + 1);
2227
2227
            pf->text = &pf->textbuf;
2228
 
            memset(pf->textbuf, 0, sz);
2229
 
            p = pf->textbuf;
 
2228
            pf->textbuf[sz] = '\0';                     /* tie off overflow */
 
2229
            /* note: "pf" overloaded */
2230
2230
            for(pf = header->custom; pf && pf->name; pf = pf->next){
2231
 
                if(pf != header->custom){
2232
 
                    sstrncpy(&p, ",", sz-(p-pf->textbuf));
2233
 
                    pf->textbuf[sz-1] = '\0';
 
2231
                int r = sz - (pend - pstart);           /* remaining buffer */
 
2232
 
 
2233
                if(r > 0 && r != sz){
 
2234
                    r--;
 
2235
                    *pend++ = ',';
2234
2236
                }
2235
2237
 
2236
 
                sstrncpy(&p, pf->name, sz-(p-pf->textbuf));
2237
 
                pf->textbuf[sz-1] = '\0';
 
2238
                sstrncpy(&pend, pf->name, r);
2238
2239
            }
2239
2240
        }
2240
2241