]> git.saurik.com Git - apple/libc.git/blobdiff - posix1e/acl_translate.c
Libc-1439.100.3.tar.gz
[apple/libc.git] / posix1e / acl_translate.c
index 3a06fffaa802aef9dd9b58fdf7ec44e9449d5d3b..57cb01f1b1fa410b0ce0207f083c3551a829dc88 100644 (file)
@@ -249,7 +249,6 @@ static struct {
 /*
  * reallocing snprintf with offset
  */
-
 static int
 raosnprintf(char **buf, size_t *size, ssize_t *offset, char *fmt, ...)
 {
@@ -350,7 +349,7 @@ acl_from_text(const char *buf_p)
         */
        field = strsep(&entry, " ");
        errno = 0;
-       if (!*field || strtol(field, NULL, 0) != 1)
+       if (field == NULL || !*field || strtol(field, NULL, 0) != 1)
        {
            error = EINVAL;
            goto exit;
@@ -699,8 +698,8 @@ acl_to_text(acl_t acl, ssize_t *len_p)
                }
            }
        }
-       buf[(*len_p)++] = '\n';
-       buf[(*len_p)] = 0;
+
+       if(!raosnprintf(&buf, &bufsize, len_p, "\n")) goto err_nomem;
        return buf;
 
 err_nomem: