[vlc-commits] [Git][videolan/vlc][master] module: bank: fix typo in framework loading

Hugo Beauzée-Luyssen (@chouquette) gitlab at videolan.org
Sat Jul 30 10:01:28 UTC 2022



Hugo Beauzée-Luyssen pushed to branch master at VideoLAN / VLC


Commits:
eb47c931 by Alexandre Janniaux at 2022-07-30T09:40:49+00:00
module: bank: fix typo in framework loading

The arguments to AllocatePluginFile were written in reverse, leading to
vlc_stat failing to find the file. In addition the value that should
have been written `-(sizeof ".framework" -1)` was actually written as
`-sizeof ".framework" -1` and thus `foo_plugin` was instead `foo_plug`.

Typo from function refactor in 70d3002be1eaf1b78f1555733d02de4266b7f6ec.

- - - - -


1 changed file:

- src/modules/bank.c


Changes:

=====================================
src/modules/bank.c
=====================================
@@ -372,9 +372,9 @@ static int AllocatePluginFramework (module_bank_t *bank, const char *file,
     size_t len_name = strlen (file);
 
     /* Skip frameworks not matching plugins naming conventions. */
-    if (len_name < sizeof "_plugin.framework"
-      || strncmp(file + len_name - sizeof "_plugin.framework" + 1,
-                 "_plugin", sizeof "_plugin" - 1) != 0)
+    if (len_name < strlen("_plugin.framework")
+      || strncmp(file + len_name - strlen("_plugin.framework"),
+                 "_plugin", strlen("_plugin")) != 0)
     {
         /* The framework doesn't contain plugins, there's no need to
          * browse the rest of the framework folder. */
@@ -382,7 +382,7 @@ static int AllocatePluginFramework (module_bank_t *bank, const char *file,
     }
 
     /* The framework is a plugin, extract the dylib from it. */
-    int filename_len = len_name - sizeof ".framework" - 1;
+    int filename_len = len_name - strlen(".framework");
 
     char *framework_relpath = NULL, *framework_abspath = NULL;
     /* Compute absolute path */
@@ -484,12 +484,12 @@ static void AllocatePluginDir (module_bank_t *bank, unsigned maxdepth,
 #ifdef __APPLE__
             size_t len_name = strlen (file);
             const char *framework_extension =
-                file + len_name - sizeof ".framework" + 1;
+                file + len_name - strlen(".framework");
 
-            if (len_name > sizeof ".framework" - 1
+            if (len_name > strlen(".framework")
              && strcmp(framework_extension, ".framework") == 0)
             {
-                AllocatePluginFramework (bank, file, abspath, relpath);
+                AllocatePluginFramework (bank, file, relpath, abspath);
                 /* Don't browse framework directories. */
                 goto skip;
             }



View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/eb47c931a06ca8460a3720e4640559e83121bbb7

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/eb47c931a06ca8460a3720e4640559e83121bbb7
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list