[BACK]Return to roff.c CVS log [TXT][DIR] Up to [cvsweb.bsd.lv] / mandoc

Diff for /mandoc/roff.c between version 1.291 and 1.292

version 1.291, 2017/03/03 13:55:32 version 1.292, 2017/03/08 13:18:10
Line 3038  roff_userdef(ROFF_ARGS)
Line 3038  roff_userdef(ROFF_ARGS)
 {  {
         const char       *arg[9], *ap;          const char       *arg[9], *ap;
         char             *cp, *n1, *n2;          char             *cp, *n1, *n2;
         int               i, ib, ie;          int               expand_count, i, ib, ie;
         size_t            asz, rsz;          size_t            asz, rsz;
   
         /*          /*
Line 3062  roff_userdef(ROFF_ARGS)
Line 3062  roff_userdef(ROFF_ARGS)
          */           */
   
         buf->sz = strlen(r->current_string) + 1;          buf->sz = strlen(r->current_string) + 1;
         n1 = cp = mandoc_malloc(buf->sz);          n1 = n2 = cp = mandoc_malloc(buf->sz);
         memcpy(n1, r->current_string, buf->sz);          memcpy(n1, r->current_string, buf->sz);
           expand_count = 0;
         while (*cp != '\0') {          while (*cp != '\0') {
   
                 /* Scan ahead for the next argument invocation. */                  /* Scan ahead for the next argument invocation. */
Line 3081  roff_userdef(ROFF_ARGS)
Line 3082  roff_userdef(ROFF_ARGS)
                                 continue;                                  continue;
                 }                  }
                 cp -= 2;                  cp -= 2;
   
                   /*
                    * Prevent infinite recursion.
                    */
   
                   if (cp >= n2)
                           expand_count = 1;
                   else if (++expand_count > EXPAND_LIMIT) {
                           mandoc_msg(MANDOCERR_ROFFLOOP, r->parse,
                               ln, (int)(cp - n1), NULL);
                           return ROFF_IGN;
                   }
   
                 /*                  /*
                  * Determine the size of the expanded argument,                   * Determine the size of the expanded argument,

Legend:
Removed from v.1.291  
changed lines
  Added in v.1.292

CVSweb