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);
        }
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to