[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v2 6/7] Mini-OS: add open and close handling to the 9pfs frontend



On 10.02.23 19:53, Samuel Thibault wrote:
Juergen Gross, le ven. 10 févr. 2023 11:46:27 +0100, a ecrit:
+static bool path_canonical(const char *pathname)
+{
+    unsigned int len = strlen(pathname);
+    const char *c;
+
+    /* Empty path is allowed. */
+    if ( !len )
+        return true;
+
+    /* No trailing '/'. */
+    if ( pathname[len - 1] == '/' )
+        return false;
+
+    /* No self or parent references. */
+    c = pathname;
+    while ( (c = strstr(c, "/.")) != NULL )
+    {
+        if ( c[2] == '.' )
+            c++;
+        if ( c[2] == 0 || c[2] == '/' )
+            return false;
+        c += 2;
+    }
+
+    return true;
+}

This doesn't seem to be catching "//"?

Oh, silly me!


Juergen

Attachment: OpenPGP_0xB0DE9DD628BF132F.asc
Description: OpenPGP public key

Attachment: OpenPGP_signature
Description: OpenPGP digital signature


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.