Project homepage Mailing List  Warmcat.com  API Docs  Github Mirror 
{"schema":"libjg2-1", "vpath":"/git/", "avatar":"/git/avatar/", "alang":"", "gen_ut":1713495355, "reponame":"libwebsockets", "desc":"libwebsockets lightweight C networking library", "owner": { "name": "Andy Green", "email": "andy@warmcat.com", "md5": "c50933ca2aa61e0fe2c43d46bb6b59cb" },"url":"https://libwebsockets.org/repo/libwebsockets", "f":3, "items": [ {"schema":"libjg2-1", "cid":"c3176a01680337793fce1fad4d68c80e", "oid":{ "oid": "f28a45246e7ea479718ddba5e80deb355b23f5f3", "alias": [ "refs/heads/main"]},"blobname": "include/libwebsockets/lws-purify.h", "blob": "/*\n * libwebsockets - small server side websockets and web server implementation\n *\n * Copyright (C) 2010 - 2019 Andy Green \u003candy@warmcat.com\u003e\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \u0022Software\u0022), to\n * deal in the Software without restriction, including without limitation the\n * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or\n * sell copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \u0022AS IS\u0022, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS\n * IN THE SOFTWARE.\n */\n\n/*! \u005cdefgroup pur Sanitize / purify SQL and JSON helpers\n *\n * ##Sanitize / purify SQL and JSON helpers\n *\n * APIs for escaping untrusted JSON and SQL safely before use\n */\n//@{\n\n/**\n * lws_sql_purify() - like strncpy but with escaping for sql quotes\n *\n * \u005cparam escaped: output buffer\n * \u005cparam string: input buffer ('/0' terminated)\n * \u005cparam len: output buffer max length\n *\n * Because escaping expands the output string, it's not\n * possible to do it in-place, ie, with escaped \u003d\u003d string\n */\nLWS_VISIBLE LWS_EXTERN const char *\nlws_sql_purify(char *escaped, const char *string, size_t len);\n\n/**\n * lws_sql_purify_len() - return length of purified version of input string\n *\n * \u005cparam string: input buffer ('/0' terminated)\n *\n * Calculates any character escaping without writing it anywhere and returns the\n * calculated length of the purified string.\n */\nint\nlws_sql_purify_len(const char *p);\n\n/**\n * lws_json_purify() - like strncpy but with escaping for json chars\n *\n * \u005cparam escaped: output buffer\n * \u005cparam string: input buffer ('/0' terminated)\n * \u005cparam len: output buffer max length\n * \u005cparam in_used: number of bytes of string we could escape in len\n *\n * Because escaping expands the output string, it's not\n * possible to do it in-place, ie, with escaped \u003d\u003d string\n */\nLWS_VISIBLE LWS_EXTERN const char *\nlws_json_purify(char *escaped, const char *string, int len, int *in_used);\n\n/**\n * lws_json_purify_len() - find out the escaped length of a string\n *\n * \u005cparam string: input buffer ('/0' terminated)\n *\n * JSON may have to expand escapes by up to 6x the original depending on what\n * it is. This doesn't actually do the escaping but goes through the motions\n * and computes the length of the escaped string.\n */\nLWS_VISIBLE LWS_EXTERN int\nlws_json_purify_len(const char *string);\n\n/**\n * lws_filename_purify_inplace() - replace scary filename chars with underscore\n *\n * \u005cparam filename: filename to be purified\n *\n * Replace scary characters in the filename (it should not be a path)\n * with underscore, so it's safe to use.\n */\nLWS_VISIBLE LWS_EXTERN void\nlws_filename_purify_inplace(char *filename);\n\nLWS_VISIBLE LWS_EXTERN int\nlws_plat_write_cert(struct lws_vhost *vhost, int is_key, int fd, void *buf,\n\t\t\tsize_t len);\nLWS_VISIBLE LWS_EXTERN int\nlws_plat_write_file(const char *filename, void *buf, size_t len);\n\nLWS_VISIBLE LWS_EXTERN int\nlws_plat_read_file(const char *filename, void *buf, size_t len);\n\nLWS_VISIBLE LWS_EXTERN int\nlws_plat_recommended_rsa_bits(void);\n///@}\n","s":{"c":1713495355,"u": 214}} ],"g": 1868,"chitpc": 0,"ehitpc": 0,"indexed":0 , "ab": 1, "si": 0, "db":0, "di":0, "sat":0, "lfc": "0000"}