Tests: test_uuid: unchecked return value
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Tue, 14 Jun 2022 14:56:35 +0000 (10:56 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Wed, 15 Jun 2022 15:07:45 +0000 (11:07 -0400)
1490026 Unchecked return value
If the function returns an error value, the error value may be mistaken
for a normal value.

In run_test_lttng_uuid_is_equal(): Value returned from a function is not
checked for errors before being used (CWE-252)

Reported-by: Coverity Scan
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: Id9558a07ebcc47f5630deed32f5a457ba002bfe6

tests/unit/test_uuid.cpp

index 403e1f0ea22a841da69ca3aca80687f745e07f6a..07a2f4afb221d393f5fc9c5dfb095520e5927d05 100644 (file)
@@ -108,12 +108,15 @@ void run_test_lttng_uuid_is_equal(void)
        int ret;
        lttng_uuid uuid1, uuid2;
 
-       lttng_uuid_from_str(valid_str_1, uuid1);
-       lttng_uuid_from_str(valid_str_1, uuid2);
+       ret = lttng_uuid_from_str(valid_str_1, uuid1);
+       assert(ret == 0);
+       ret = lttng_uuid_from_str(valid_str_1, uuid2);
+       assert(ret == 0);
        ret = uuid1 == uuid2;
        ok(ret == true, "lttng_uuid_is_equal - Compare same UUID, expect success");
 
-       lttng_uuid_from_str(valid_str_2, uuid2);
+       ret = lttng_uuid_from_str(valid_str_2, uuid2);
+       assert(ret == 0);
        ret = uuid1 == uuid2;
        ok(ret == false, "lttng_uuid_is_equal - Compare different UUID, expect failure");
 }
This page took 0.026494 seconds and 5 git commands to generate.