svn commit: r303727 - head/bin/uuidgen
Mariusz Zaborski
oshogbo at FreeBSD.org
Wed Aug 3 18:04:09 UTC 2016
Author: oshogbo
Date: Wed Aug 3 18:04:08 2016
New Revision: 303727
URL: https://svnweb.freebsd.org/changeset/base/303727
Log:
uuid_to_string(3) is allocating memory and can fail on that.
Check if any error accrued.
Modified:
head/bin/uuidgen/uuidgen.c
Modified: head/bin/uuidgen/uuidgen.c
==============================================================================
--- head/bin/uuidgen/uuidgen.c Wed Aug 3 18:03:14 2016 (r303726)
+++ head/bin/uuidgen/uuidgen.c Wed Aug 3 18:04:08 2016 (r303727)
@@ -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);
}
More information about the svn-src-head
mailing list