Skip to content

Instantly share code, notes, and snippets.

@Micrified
Created March 12, 2019 06:30
Show Gist options
  • Save Micrified/00aa24d8bc607a025e13425cbf765b83 to your computer and use it in GitHub Desktop.
Save Micrified/00aa24d8bc607a025e13425cbf765b83 to your computer and use it in GitHub Desktop.
Interesting excerp from Cockpit source code
static gboolean
validate_path (const gchar *name)
{
static const gchar *allowed = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_.,/";
gsize len = strspn (name, allowed);
return len && name[len] == '\0';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment