Date: Sat, 3 Mar 2018 11:02:34 +0000 (UTC) From: Eitan Adler <eadler@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r330329 - stable/11/bin/uuidgen Message-ID: <201803031102.w23B2YDh046160@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: eadler Date: Sat Mar 3 11:02:34 2018 New Revision: 330329 URL: https://svnweb.freebsd.org/changeset/base/330329 Log: MFC r303727: uuid_to_string(3) is allocating memory and can fail on that. Check if any error accrued. Modified: stable/11/bin/uuidgen/uuidgen.c Directory Properties: stable/11/ (props changed) Modified: stable/11/bin/uuidgen/uuidgen.c ============================================================================== --- stable/11/bin/uuidgen/uuidgen.c Sat Mar 3 10:50:16 2018 (r330328) +++ stable/11/bin/uuidgen/uuidgen.c Sat Mar 3 11:02:34 2018 (r330329) @@ -47,7 +47,7 @@ main(int argc, char *argv[]) FILE *fp; uuid_t *store, *uuid; char *p; - int ch, count, i, iterate; + int ch, count, i, iterate, status; count = -1; /* no count yet */ fp = stdout; /* default output file */ @@ -101,7 +101,9 @@ main(int argc, char *argv[]) uuid = store; while (count--) { - uuid_to_string(uuid++, &p, NULL); + uuid_to_string(uuid++, &p, &status); + if (status != uuid_s_ok) + err(1, "cannot stringify a UUID"); fprintf(fp, "%s\n", p); free(p); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201803031102.w23B2YDh046160>