Print this page
9718 update mandoc to 1.14.4

Split Close
Expand all
Collapse all
          --- old/usr/src/cmd/mandoc/mandoc_aux.c
          +++ new/usr/src/cmd/mandoc/mandoc_aux.c
   1      -/*      $Id: mandoc_aux.c,v 1.10 2017/06/12 19:05:47 schwarze Exp $ */
        1 +/*      $Id: mandoc_aux.c,v 1.11 2018/02/07 20:04:57 schwarze Exp $ */
   2    2  /*
   3    3   * Copyright (c) 2009, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
   4    4   * Copyright (c) 2014, 2015, 2017 Ingo Schwarze <schwarze@openbsd.org>
   5    5   *
   6    6   * Permission to use, copy, modify, and distribute this software for any
   7    7   * purpose with or without fee is hereby granted, provided that the above
   8    8   * copyright notice and this permission notice appear in all copies.
   9    9   *
  10   10   * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHORS DISCLAIM ALL WARRANTIES
  11   11   * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
↓ open down ↓ 92 lines elided ↑ open up ↑
 104  104          if (p == NULL)
 105  105                  err((int)MANDOCLEVEL_SYSERR, NULL);
 106  106          return p;
 107  107  }
 108  108  
 109  109  char *
 110  110  mandoc_strndup(const char *ptr, size_t sz)
 111  111  {
 112  112          char    *p;
 113  113  
 114      -        p = mandoc_malloc(sz + 1);
 115      -        memcpy(p, ptr, sz);
 116      -        p[(int)sz] = '\0';
      114 +        p = strndup(ptr, sz);
      115 +        if (p == NULL)
      116 +                err((int)MANDOCLEVEL_SYSERR, NULL);
 117  117          return p;
 118  118  }
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX