mainCompact Disc Input and Control Library - Support: sr #110699, FAIL: realpath with recent glibc...

 
 

sr #110699: FAIL: realpath with recent glibc release

Submitter:  Martin Liška <marxin>
Submitted:  Mon 22 Aug 2022 04:12:37 AM UTC
   
 
Category:  None Priority:  5 - Normal
Severity:  3 - Normal Status:  None
Privacy:  Public Assigned to:  None
Open/Closed:  Open Operating System:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Mon 22 Aug 2022 04:12:37 AM UTC, original submission:  

Fails here:

        /* Make sure we handle a cyclic symbolic name, e.g. xx -> xx */
        cdio_realpath(psz_symlink_file, symlink_file);
        rc = check_rc(symlink(psz_symlink_file, psz_symlink_file),
                      "symlink", psz_symlink_file);
        if (0 == rc) {
            cdio_realpath(psz_symlink_file, psz_file_check);

Where psz_symlink_file is a symlink that points to itself and the problem is that cdio_realpath returns NULL and thus the content of symlink_file is undefined.

The following patches that:

diff --git a/test/driver/realpath.c b/test/driver/realpath.c
index 289253e4..4e85af96 100644
--- a/test/driver/realpath.c
+++ b/test/driver/realpath.c
@@ -175,14 +175,16 @@ main(int argc, const char *argv[])
         rc = check_rc(symlink(psz_symlink_file, psz_symlink_file),
                       "symlink", psz_symlink_file);
         if (0 == rc) {
-            cdio_realpath(psz_symlink_file, psz_file_check);
-            if (0 != strncmp(psz_file_check, symlink_file, PATH_MAX)) {
-                fprintf(stderr, "direct cdio_realpath cycle test failed. %s vs %s\n",
-                        psz_file_check, symlink_file);
- rc = 5;
- goto err_exit;
+            char *retvalue = cdio_realpath(psz_symlink_file, psz_file_check);
+            if (0 != retvalue) {
+                if (0 != strncmp(psz_file_check, symlink_file, PATH_MAX)) {
+                  fprintf(stderr, "direct cdio_realpath cycle test failed. %s vs %s\n",
+                      psz_file_check, symlink_file);
+                  rc = 5;
+                  goto err_exit;
+                }
+                check_rc(unlink(psz_symlink_file), "unlink", psz_symlink_file);
             }
-            check_rc(unlink(psz_symlink_file), "unlink", psz_symlink_file);
         }
 
     }

Martin Liška <marxin>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by marxin (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    No changes have been made to this item

    Back to the top

    Powered by Savane 3.13-6ae7.
    Corresponding source code