{"schema":"libjg2-1",
"vpath":"/git/",
"avatar":"/git/avatar/",
"alang":"",
"gen_ut":1752653084,
"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":"5df655f8d4f1f12c6b1577e5fa6ab5be",
"commit": {"type":"commit",
"time": 1473879272,
"time_ofs": 480,
"oid_tree": { "oid": "a905200cda6886e4430290ded2b808642ffd3261", "alias": []},
"oid":{ "oid": "1f02bd2e66d7d27c6c1a137eaf86a2337d867b55", "alias": []},
"msg": "lws_snprintf",
"sig_commit": { "git_time": { "time": 1473879272, "offset": 480 }, "name": "Andy Green", "email": "andy@warmcat.com", "md5": "c50933ca2aa61e0fe2c43d46bb6b59cb" },
"sig_author": { "git_time": { "time": 1473879272, "offset": 480 }, "name": "Andy Green", "email": "andy@warmcat.com", "md5": "c50933ca2aa61e0fe2c43d46bb6b59cb" }},
"body": "lws_snprintf\n\nThanks to Fabrice Gilot for reporting the problem that led to uncovering this.\n\nDue to a misunderstanding of the return value of snprintf (it is not truncated according\nto the max size passed in) in several places relying on snprintf to truncate the length\noverflows are possible.\n\nThis patch wraps snprintf with a new lws_snprintf() which does truncate its length to allow\nthe buffer limiting scheme to work properly.\n\nAll users should update with these fixes."
,
"diff": "diff --git a/lib/client-handshake.c b/lib/client-handshake.c\nindex 6892f5d..35e296a 100644\n--- a/lib/client-handshake.c\n+++ b/lib/client-handshake.c\n@@ -366,7 +366,7 @@ html_parser_cb(const hubbub_token *token, void *pw)\n \tswitch (token-\u003etype) {\n \tcase HUBBUB_TOKEN_DOCTYPE:\n \n-\t\tp +\u003d snprintf(p, end - p, \u0022\u003c!DOCTYPE %.*s %s \u0022,\n+\t\tp +\u003d lws_snprintf(p, end - p, \u0022\u003c!DOCTYPE %.*s %s \u0022,\n \t\t\t\t(int) token-\u003edata.doctype.name.len,\n \t\t\t\ttoken-\u003edata.doctype.name.ptr,\n \t\t\t\ttoken-\u003edata.doctype.force_quirks ?\n@@ -375,20 +375,20 @@ html_parser_cb(const hubbub_token *token, void *pw)\n \t\tif (token-\u003edata.doctype.public_missing)\n \t\t\tprintf(\u0022\u005ctpublic: missing\u005cn\u0022);\n \t\telse\n-\t\t\tp +\u003d snprintf(p, end - p, \u0022PUBLIC \u005c\u0022%.*s\u005c\u0022\u005cn\u0022,\n+\t\t\tp +\u003d lws_snprintf(p, end - p, \u0022PUBLIC \u005c\u0022%.*s\u005c\u0022\u005cn\u0022,\n \t\t\t\t(int) token-\u003edata.doctype.public_id.len,\n \t\t\t\ttoken-\u003edata.doctype.public_id.ptr);\n \n \t\tif (token-\u003edata.doctype.system_missing)\n \t\t\tprintf(\u0022\u005ctsystem: missing\u005cn\u0022);\n \t\telse\n-\t\t\tp +\u003d snprintf(p, end - p, \u0022 \u005c\u0022%.*s\u005c\u0022\u003e\u005cn\u0022,\n+\t\t\tp +\u003d lws_snprintf(p, end - p, \u0022 \u005c\u0022%.*s\u005c\u0022\u003e\u005cn\u0022,\n \t\t\t\t(int) token-\u003edata.doctype.system_id.len,\n \t\t\t\ttoken-\u003edata.doctype.system_id.ptr);\n \n \t\tbreak;\n \tcase HUBBUB_TOKEN_START_TAG:\n-\t\tp +\u003d snprintf(p, end - p, \u0022\u003c%.*s\u0022, (int)token-\u003edata.tag.name.len,\n+\t\tp +\u003d lws_snprintf(p, end - p, \u0022\u003c%.*s\u0022, (int)token-\u003edata.tag.name.len,\n \t\t\t\ttoken-\u003edata.tag.name.ptr);\n \n /*\t\t\t\t(token-\u003edata.tag.self_closing) ?\n@@ -408,23 +408,23 @@ html_parser_cb(const hubbub_token *token, void *pw)\n \t\t\t\t\tpp +\u003d r-\u003efrom_len;\n \t\t\t\t\tplen -\u003d r-\u003efrom_len;\n \t\t\t\t}\n-\t\t\t\tp +\u003d snprintf(p, end - p, \u0022 %.*s\u003d\u005c\u0022%s/%.*s\u005c\u0022\u0022,\n+\t\t\t\tp +\u003d lws_snprintf(p, end - p, \u0022 %.*s\u003d\u005c\u0022%s/%.*s\u005c\u0022\u0022,\n \t\t\t\t (int) token-\u003edata.tag.attributes[i].name.len,\n \t\t\t\t token-\u003edata.tag.attributes[i].name.ptr,\n \t\t\t\t r-\u003eto, plen, pp);\n \n \t\t\t} else\n \n-\t\t\t\tp +\u003d snprintf(p, end - p, \u0022 %.*s\u003d\u005c\u0022%.*s\u005c\u0022\u0022,\n+\t\t\t\tp +\u003d lws_snprintf(p, end - p, \u0022 %.*s\u003d\u005c\u0022%.*s\u005c\u0022\u0022,\n \t\t\t\t\t(int) token-\u003edata.tag.attributes[i].name.len,\n \t\t\t\t\ttoken-\u003edata.tag.attributes[i].name.ptr,\n \t\t\t\t\t(int) token-\u003edata.tag.attributes[i].value.len,\n \t\t\t\t\ttoken-\u003edata.tag.attributes[i].value.ptr);\n \t\t}\n-\t\tp +\u003d snprintf(p, end - p, \u0022\u003e\u005cn\u0022);\n+\t\tp +\u003d lws_snprintf(p, end - p, \u0022\u003e\u005cn\u0022);\n \t\tbreak;\n \tcase HUBBUB_TOKEN_END_TAG:\n-\t\tp +\u003d snprintf(p, end - p, \u0022\u003c/%.*s\u0022, (int) token-\u003edata.tag.name.len,\n+\t\tp +\u003d lws_snprintf(p, end - p, \u0022\u003c/%.*s\u0022, (int) token-\u003edata.tag.name.len,\n \t\t\t\ttoken-\u003edata.tag.name.ptr);\n /*\n \t\t\t\t(token-\u003edata.tag.self_closing) ?\n@@ -433,25 +433,25 @@ html_parser_cb(const hubbub_token *token, void *pw)\n \t\t\t\t\t\t\u0022attributes:\u0022 : \u0022\u0022);\n */\n \t\tfor (i \u003d 0; i \u003c token-\u003edata.tag.n_attributes; i++) {\n-\t\t\tp +\u003d snprintf(p, end - p, \u0022 %.*s\u003d'%.*s'\u005cn\u0022,\n+\t\t\tp +\u003d lws_snprintf(p, end - p, \u0022 %.*s\u003d'%.*s'\u005cn\u0022,\n \t\t\t\t(int) token-\u003edata.tag.attributes[i].name.len,\n \t\t\t\ttoken-\u003edata.tag.attributes[i].name.ptr,\n \t\t\t\t(int) token-\u003edata.tag.attributes[i].value.len,\n \t\t\t\ttoken-\u003edata.tag.attributes[i].value.ptr);\n \t\t}\n-\t\tp +\u003d snprintf(p, end - p, \u0022\u003e\u005cn\u0022);\n+\t\tp +\u003d lws_snprintf(p, end - p, \u0022\u003e\u005cn\u0022);\n \t\tbreak;\n \tcase HUBBUB_TOKEN_COMMENT:\n-\t\tp +\u003d snprintf(p, end - p, \u0022\u003c!-- %.*s --\u003e\u005cn\u0022,\n+\t\tp +\u003d lws_snprintf(p, end - p, \u0022\u003c!-- %.*s --\u003e\u005cn\u0022,\n \t\t\t\t(int) token-\u003edata.comment.len,\n \t\t\t\ttoken-\u003edata.comment.ptr);\n \t\tbreak;\n \tcase HUBBUB_TOKEN_CHARACTER:\n-\t\tp +\u003d snprintf(p, end - p, \u0022%.*s\u0022, (int) token-\u003edata.character.len,\n+\t\tp +\u003d lws_snprintf(p, end - p, \u0022%.*s\u0022, (int) token-\u003edata.character.len,\n \t\t\t\ttoken-\u003edata.character.ptr);\n \t\tbreak;\n \tcase HUBBUB_TOKEN_EOF:\n-\t\tp +\u003d snprintf(p, end - p, \u0022\u005cn\u0022);\n+\t\tp +\u003d lws_snprintf(p, end - p, \u0022\u005cn\u0022);\n \t\tbreak;\n \t}\n \ndiff --git a/lib/libuv.c b/lib/libuv.c\nindex 64e5a7e..bb1bee3 100644\n--- a/lib/libuv.c\n+++ b/lib/libuv.c\n@@ -484,14 +484,14 @@ lws_plat_plugins_init(struct lws_context * context, const char * const *d)\n \n \t\t\tlwsl_notice(\u0022 %s\u005cn\u0022, dent.name);\n \n-\t\t\tsnprintf(path, sizeof(path) - 1, \u0022%s/%s\u0022, *d, dent.name);\n+\t\t\tlws_snprintf(path, sizeof(path) - 1, \u0022%s/%s\u0022, *d, dent.name);\n \t\t\tif (uv_dlopen(path, \u0026lib)) {\n \t\t\t\tuv_dlerror(\u0026lib);\n \t\t\t\tlwsl_err(\u0022Error loading DSO: %s\u005cn\u0022, lib.errmsg);\n \t\t\t\tgoto bail;\n \t\t\t}\n \t\t\t/* we could open it, can we get his init function? */\n-\t\t\tm \u003d snprintf(path, sizeof(path) - 1, \u0022init_%s\u0022,\n+\t\t\tm \u003d lws_snprintf(path, sizeof(path) - 1, \u0022init_%s\u0022,\n \t\t\t\t dent.name + 3 /* snip lib... */);\n \t\t\tpath[m - 3] \u003d '\u005c0'; /* snip the .so */\n \t\t\tif (uv_dlsym(\u0026lib, path, \u0026v)) {\n@@ -554,7 +554,7 @@ lws_plat_plugins_destroy(struct lws_context * context)\n \n \twhile (plugin) {\n \t\tp \u003d plugin;\n-\t\tm \u003d snprintf(path, sizeof(path) - 1, \u0022destroy_%s\u0022, plugin-\u003ename + 3);\n+\t\tm \u003d lws_snprintf(path, sizeof(path) - 1, \u0022destroy_%s\u0022, plugin-\u003ename + 3);\n \t\tpath[m - 3] \u003d '\u005c0';\n \n \t\tif (uv_dlsym(\u0026plugin-\u003elib, path, \u0026v)) {\ndiff --git a/lib/libwebsockets.c b/lib/libwebsockets.c\nindex f62c156..8562290 100755\n--- a/lib/libwebsockets.c\n+++ b/lib/libwebsockets.c\n@@ -1165,7 +1165,7 @@ lwsl_timestamp(int level, char *p, int len)\n \t\t\tcontinue;\n \t\tnow \u003d time_in_microseconds() / 100;\n \t\tif (ptm)\n-\t\t\tn \u003d snprintf(p, len,\n+\t\t\tn \u003d lws_snprintf(p, len,\n \t\t\t\t\u0022[%04d/%02d/%02d %02d:%02d:%02d:%04d] %s: \u0022,\n \t\t\t\tptm-\u003etm_year + 1900,\n \t\t\t\tptm-\u003etm_mon + 1,\n@@ -1175,7 +1175,7 @@ lwsl_timestamp(int level, char *p, int len)\n \t\t\t\tptm-\u003etm_sec,\n \t\t\t\t(int)(now % 10000), log_level_names[n]);\n \t\telse\n-\t\t\tn \u003d snprintf(p, len, \u0022[%llu:%04d] %s: \u0022,\n+\t\t\tn \u003d lws_snprintf(p, len, \u0022[%llu:%04d] %s: \u0022,\n \t\t\t\t\t(unsigned long long) now / 10000,\n \t\t\t\t\t(int)(now % 10000), log_level_names[n]);\n \t\treturn n;\n@@ -1683,6 +1683,24 @@ lws_finalize_startup(struct lws_context *context)\n \treturn 0;\n }\n \n+int\n+lws_snprintf(char *str, size_t size, const char *format, ...)\n+{\n+\tva_list ap;\n+\tint n;\n+\n+\tif (!size)\n+\t\treturn 0;\n+\n+\tva_start(ap, format);\n+\tn \u003d vsnprintf(str, size, format, ap);\n+\tva_end(ap);\n+\n+\tif (n \u003e\u003d size)\n+\t\treturn size;\n+\n+\treturn n;\n+}\n \n LWS_VISIBLE LWS_EXTERN int\n lws_is_cgi(struct lws *wsi) {\n@@ -1831,7 +1849,7 @@ lws_cgi(struct lws *wsi, const char * const *exec_array, int script_uri_path_len\n \tif (wsi-\u003eu.hdr.ah) {\n \t\tif (lws_hdr_total_length(wsi, WSI_TOKEN_POST_URI))\n \t\t\turitok \u003d WSI_TOKEN_POST_URI;\n-\t\tsnprintf(cgi_path, sizeof(cgi_path) - 1, \u0022REQUEST_URI\u003d%s\u0022,\n+\t\tlws_snprintf(cgi_path, sizeof(cgi_path) - 1, \u0022REQUEST_URI\u003d%s\u0022,\n \t\t\t lws_hdr_simple_ptr(wsi, uritok));\n \t\tcgi_path[sizeof(cgi_path) - 1] \u003d '\u005c0';\n \t\tenv_array[n++] \u003d cgi_path;\n@@ -1841,7 +1859,7 @@ lws_cgi(struct lws *wsi, const char * const *exec_array, int script_uri_path_len\n \t\t\tenv_array[n++] \u003d \u0022REQUEST_METHOD\u003dGET\u0022;\n \n \t\tenv_array[n++] \u003d p;\n-\t\tp +\u003d snprintf(p, end - p, \u0022QUERY_STRING\u003d\u0022);\n+\t\tp +\u003d lws_snprintf(p, end - p, \u0022QUERY_STRING\u003d\u0022);\n \t\t/* dump the individual URI Arg parameters */\n \t\tm \u003d 0;\n \t\twhile (1) {\n@@ -1866,55 +1884,55 @@ lws_cgi(struct lws *wsi, const char * const *exec_array, int script_uri_path_len\n \t\t*p++ \u003d '\u005c0';\n \n \t\tenv_array[n++] \u003d p;\n-\t\tp +\u003d snprintf(p, end - p, \u0022PATH_INFO\u003d%s\u0022,\n+\t\tp +\u003d lws_snprintf(p, end - p, \u0022PATH_INFO\u003d%s\u0022,\n \t\t\t lws_hdr_simple_ptr(wsi, uritok) +\n \t\t\t script_uri_path_len);\n \t\tp++;\n \t}\n \tif (lws_hdr_total_length(wsi, WSI_TOKEN_HTTP_REFERER)) {\n \t\tenv_array[n++] \u003d p;\n-\t\tp +\u003d snprintf(p, end - p, \u0022HTTP_REFERER\u003d%s\u0022,\n+\t\tp +\u003d lws_snprintf(p, end - p, \u0022HTTP_REFERER\u003d%s\u0022,\n \t\t\t lws_hdr_simple_ptr(wsi, WSI_TOKEN_HTTP_REFERER));\n \t\tp++;\n \t}\n \tif (lws_hdr_total_length(wsi, WSI_TOKEN_HOST)) {\n \t\tenv_array[n++] \u003d p;\n-\t\tp +\u003d snprintf(p, end - p, \u0022HTTP_HOST\u003d%s\u0022,\n+\t\tp +\u003d lws_snprintf(p, end - p, \u0022HTTP_HOST\u003d%s\u0022,\n \t\t\t lws_hdr_simple_ptr(wsi, WSI_TOKEN_HOST));\n \t\tp++;\n \t}\n \tif (lws_hdr_total_length(wsi, WSI_TOKEN_HTTP_COOKIE)) {\n \t\tenv_array[n++] \u003d p;\n-\t\tp +\u003d snprintf(p, end - p, \u0022HTTP_COOKIE\u003d%s\u0022,\n+\t\tp +\u003d lws_snprintf(p, end - p, \u0022HTTP_COOKIE\u003d%s\u0022,\n \t\t\t lws_hdr_simple_ptr(wsi, WSI_TOKEN_HTTP_COOKIE));\n \t\tp++;\n \t}\n \tif (lws_hdr_total_length(wsi, WSI_TOKEN_HTTP_USER_AGENT)) {\n \t\tenv_array[n++] \u003d p;\n-\t\tp +\u003d snprintf(p, end - p, \u0022USER_AGENT\u003d%s\u0022,\n+\t\tp +\u003d lws_snprintf(p, end - p, \u0022USER_AGENT\u003d%s\u0022,\n \t\t\t lws_hdr_simple_ptr(wsi, WSI_TOKEN_HTTP_USER_AGENT));\n \t\tp++;\n \t}\n \tif (uritok \u003d\u003d WSI_TOKEN_POST_URI) {\n \t\tif (lws_hdr_total_length(wsi, WSI_TOKEN_HTTP_CONTENT_TYPE)) {\n \t\t\tenv_array[n++] \u003d p;\n-\t\t\tp +\u003d snprintf(p, end - p, \u0022CONTENT_TYPE\u003d%s\u0022,\n+\t\t\tp +\u003d lws_snprintf(p, end - p, \u0022CONTENT_TYPE\u003d%s\u0022,\n \t\t\t\t lws_hdr_simple_ptr(wsi, WSI_TOKEN_HTTP_CONTENT_TYPE));\n \t\t\tp++;\n \t\t}\n \t\tif (lws_hdr_total_length(wsi, WSI_TOKEN_HTTP_CONTENT_LENGTH)) {\n \t\t\tenv_array[n++] \u003d p;\n-\t\t\tp +\u003d snprintf(p, end - p, \u0022CONTENT_LENGTH\u003d%s\u0022,\n+\t\t\tp +\u003d lws_snprintf(p, end - p, \u0022CONTENT_LENGTH\u003d%s\u0022,\n \t\t\t\t lws_hdr_simple_ptr(wsi, WSI_TOKEN_HTTP_CONTENT_LENGTH));\n \t\t\tp++;\n \t\t}\n \t}\n \tenv_array[n++] \u003d p;\n-\tp +\u003d snprintf(p, end - p, \u0022SCRIPT_PATH\u003d%s\u0022, exec_array[0]) + 1;\n+\tp +\u003d lws_snprintf(p, end - p, \u0022SCRIPT_PATH\u003d%s\u0022, exec_array[0]) + 1;\n \n \twhile (mp_cgienv) {\n \t\tenv_array[n++] \u003d p;\n-\t\tp +\u003d snprintf(p, end - p, \u0022%s\u003d%s\u0022, mp_cgienv-\u003ename,\n+\t\tp +\u003d lws_snprintf(p, end - p, \u0022%s\u003d%s\u0022, mp_cgienv-\u003ename,\n \t\t\t mp_cgienv-\u003evalue);\n \t\tlwsl_debug(\u0022 Applying mount-specific cgi env '%s'\u005cn\u0022,\n \t\t\t env_array[n - 1]);\n@@ -2360,7 +2378,7 @@ lws_access_log(struct lws *wsi)\n \tif (!p)\n \t\tp \u003d \u0022\u0022;\n \n-\tl \u003d snprintf(ass, sizeof(ass) - 1, \u0022%s %d %lu %s\u005cn\u0022,\n+\tl \u003d lws_snprintf(ass, sizeof(ass) - 1, \u0022%s %d %lu %s\u005cn\u0022,\n \t\t wsi-\u003eaccess_log.header_log,\n \t\t wsi-\u003eaccess_log.response, wsi-\u003eaccess_log.sent, p);\n \n@@ -2403,7 +2421,7 @@ lws_json_dump_vhost(const struct lws_vhost *vh, char *buf, int len)\n \tif (len \u003c 100)\n \t\treturn 0;\n \n-\tbuf +\u003d snprintf(buf, end - buf,\n+\tbuf +\u003d lws_snprintf(buf, end - buf,\n \t\t\t\u0022{\u005cn \u005c\u0022name\u005c\u0022:\u005c\u0022%s\u005c\u0022,\u005cn\u0022\n \t\t\t\u0022 \u005c\u0022port\u005c\u0022:\u005c\u0022%d\u005c\u0022,\u005cn\u0022\n \t\t\t\u0022 \u005c\u0022use_ssl\u005c\u0022:\u005c\u0022%d\u005c\u0022,\u005cn\u0022\n@@ -2429,11 +2447,11 @@ lws_json_dump_vhost(const struct lws_vhost *vh, char *buf, int len)\n \tif (vh-\u003emount_list) {\n \t\tconst struct lws_http_mount *m \u003d vh-\u003emount_list;\n \n-\t\tbuf +\u003d snprintf(buf, end - buf, \u0022,\u005cn \u005c\u0022mounts\u005c\u0022:[\u0022);\n+\t\tbuf +\u003d lws_snprintf(buf, end - buf, \u0022,\u005cn \u005c\u0022mounts\u005c\u0022:[\u0022);\n \t\twhile (m) {\n \t\t\tif (!first)\n-\t\t\t\tbuf +\u003d snprintf(buf, end - buf, \u0022,\u0022);\n-\t\t\tbuf +\u003d snprintf(buf, end - buf,\n+\t\t\t\tbuf +\u003d lws_snprintf(buf, end - buf, \u0022,\u0022);\n+\t\t\tbuf +\u003d lws_snprintf(buf, end - buf,\n \t\t\t\t\t\u0022\u005cn {\u005cn \u005c\u0022mountpoint\u005c\u0022:\u005c\u0022%s\u005c\u0022,\u005cn\u0022\n \t\t\t\t\t\u0022 \u005c\u0022origin\u005c\u0022:\u005c\u0022%s%s\u005c\u0022,\u005cn\u0022\n \t\t\t\t\t\u0022 \u005c\u0022cache_max_age\u005c\u0022:\u005c\u0022%d\u005c\u0022,\u005cn\u0022\n@@ -2449,25 +2467,25 @@ lws_json_dump_vhost(const struct lws_vhost *vh, char *buf, int len)\n \t\t\t\t\tm-\u003ecache_revalidate,\n \t\t\t\t\tm-\u003ecache_intermediaries);\n \t\t\tif (m-\u003edef)\n-\t\t\t\tbuf +\u003d snprintf(buf, end - buf,\n+\t\t\t\tbuf +\u003d lws_snprintf(buf, end - buf,\n \t\t\t\t\t\t\u0022,\u005cn \u005c\u0022default\u005c\u0022:\u005c\u0022%s\u005c\u0022\u0022,\n \t\t\t\t\t\tm-\u003edef);\n-\t\t\tbuf +\u003d snprintf(buf, end - buf, \u0022\u005cn }\u0022);\n+\t\t\tbuf +\u003d lws_snprintf(buf, end - buf, \u0022\u005cn }\u0022);\n \t\t\tfirst \u003d 0;\n \t\t\tm \u003d m-\u003emount_next;\n \t\t}\n-\t\tbuf +\u003d snprintf(buf, end - buf, \u0022\u005cn ]\u0022);\n+\t\tbuf +\u003d lws_snprintf(buf, end - buf, \u0022\u005cn ]\u0022);\n \t}\n \n \tif (vh-\u003eprotocols) {\n \t\tn \u003d 0;\n \t\tfirst \u003d 1;\n \n-\t\tbuf +\u003d snprintf(buf, end - buf, \u0022,\u005cn \u005c\u0022ws-protocols\u005c\u0022:[\u0022);\n+\t\tbuf +\u003d lws_snprintf(buf, end - buf, \u0022,\u005cn \u005c\u0022ws-protocols\u005c\u0022:[\u0022);\n \t\twhile (n \u003c vh-\u003ecount_protocols) {\n \t\t\tif (!first)\n-\t\t\t\tbuf +\u003d snprintf(buf, end - buf, \u0022,\u0022);\n-\t\t\tbuf +\u003d snprintf(buf, end - buf,\n+\t\t\t\tbuf +\u003d lws_snprintf(buf, end - buf, \u0022,\u0022);\n+\t\t\tbuf +\u003d lws_snprintf(buf, end - buf,\n \t\t\t\t\t\u0022\u005cn {\u005cn \u005c\u0022%s\u005c\u0022:\u005c{\u005cn\u0022\n \t\t\t\t\t\u0022 \u005c\u0022status\u005c\u0022:\u005c\u0022ok\u005c\u0022\u005cn }\u005cn }\u0022\n \t\t\t\t\t,\n@@ -2475,10 +2493,10 @@ lws_json_dump_vhost(const struct lws_vhost *vh, char *buf, int len)\n \t\t\tfirst \u003d 0;\n \t\t\tn++;\n \t\t}\n-\t\tbuf +\u003d snprintf(buf, end - buf, \u0022\u005cn ]\u0022);\n+\t\tbuf +\u003d lws_snprintf(buf, end - buf, \u0022\u005cn ]\u0022);\n \t}\n \n-\tbuf +\u003d snprintf(buf, end - buf, \u0022\u005cn}\u0022);\n+\tbuf +\u003d lws_snprintf(buf, end - buf, \u0022\u005cn}\u0022);\n \n \treturn buf - orig;\n }\n@@ -2497,7 +2515,7 @@ lws_json_dump_context(const struct lws_context *context, char *buf, int len)\n \ttime_t t \u003d time(NULL);\n \tint listening \u003d 0, cgi_count \u003d 0, n;\n \n-\tbuf +\u003d snprintf(buf, end - buf, \u0022{ \u0022\n+\tbuf +\u003d lws_snprintf(buf, end - buf, \u0022{ \u0022\n \t\t\t\t\t\u0022\u005c\u0022version\u005c\u0022:\u005c\u0022%s\u005c\u0022,\u005cn\u0022\n \t\t\t\t\t\u0022\u005c\u0022uptime\u005c\u0022:\u005c\u0022%ld\u005c\u0022,\u005cn\u0022\n \t\t\t\t\t\u0022\u005c\u0022cgi_spawned\u005c\u0022:\u005c\u0022%d\u005c\u0022,\u005cn\u0022\n@@ -2517,19 +2535,19 @@ lws_json_dump_context(const struct lws_context *context, char *buf, int len)\n \n \t\tm \u003d getloadavg(d, 3);\n \t\tfor (n \u003d 0; n \u003c m; n++) {\n-\t\t\tbuf +\u003d snprintf(buf, end - buf,\n+\t\t\tbuf +\u003d lws_snprintf(buf, end - buf,\n \t\t\t\t\u0022\u005c\u0022l%d\u005c\u0022:\u005c\u0022%.2f\u005c\u0022,\u005cn\u0022,\n \t\t\t\tn + 1, d[n]);\n \t\t}\n \t}\n #endif\n \n-\tbuf +\u003d snprintf(buf, end - buf, \u0022\u005c\u0022pt\u005c\u0022:[\u005cn \u0022);\n+\tbuf +\u003d lws_snprintf(buf, end - buf, \u0022\u005c\u0022pt\u005c\u0022:[\u005cn \u0022);\n \tfor (n \u003d 0; n \u003c context-\u003ecount_threads; n++) {\n \t\tpt \u003d \u0026context-\u003ept[n];\n \t\tif (n)\n-\t\t\tbuf +\u003d snprintf(buf, end - buf, \u0022,\u0022);\n-\t\tbuf +\u003d snprintf(buf, end - buf,\n+\t\t\tbuf +\u003d lws_snprintf(buf, end - buf, \u0022,\u0022);\n+\t\tbuf +\u003d lws_snprintf(buf, end - buf,\n \t\t\t\t\u0022\u005cn {\u005cn\u0022\n \t\t\t\t\u0022 \u005c\u0022fds_count\u005c\u0022:\u005c\u0022%d\u005c\u0022,\u005cn\u0022\n \t\t\t\t\u0022 \u005c\u0022ah_pool_inuse\u005c\u0022:\u005c\u0022%d\u005c\u0022,\u005cn\u0022\n@@ -2540,7 +2558,7 @@ lws_json_dump_context(const struct lws_context *context, char *buf, int len)\n \t\t\t\tpt-\u003eah_wait_list_length);\n \t}\n \n-\tbuf +\u003d snprintf(buf, end - buf, \u0022], \u005c\u0022vhosts\u005c\u0022:[\u005cn \u0022);\n+\tbuf +\u003d lws_snprintf(buf, end - buf, \u0022], \u005c\u0022vhosts\u005c\u0022:[\u005cn \u0022);\n \n \twhile (vh) {\n \t\tif (!first)\n@@ -2553,7 +2571,7 @@ lws_json_dump_context(const struct lws_context *context, char *buf, int len)\n \t\tvh \u003d vh-\u003evhost_next;\n \t}\n \n-\tbuf +\u003d snprintf(buf, end - buf, \u0022],\u005cn\u005c\u0022listen_wsi\u005c\u0022:\u005c\u0022%d\u005c\u0022\u0022,\n+\tbuf +\u003d lws_snprintf(buf, end - buf, \u0022],\u005cn\u005c\u0022listen_wsi\u005c\u0022:\u005c\u0022%d\u005c\u0022\u0022,\n \t\t\tlistening);\n \n #ifdef LWS_WITH_CGI\n@@ -2568,10 +2586,10 @@ lws_json_dump_context(const struct lws_context *context, char *buf, int len)\n \t\t}\n \t}\n #endif\n-\tbuf +\u003d snprintf(buf, end - buf, \u0022,\u005cn \u005c\u0022cgi_alive\u005c\u0022:\u005c\u0022%d\u005c\u0022\u005cn \u0022,\n+\tbuf +\u003d lws_snprintf(buf, end - buf, \u0022,\u005cn \u005c\u0022cgi_alive\u005c\u0022:\u005c\u0022%d\u005c\u0022\u005cn \u0022,\n \t\t\tcgi_count);\n \n-\tbuf +\u003d snprintf(buf, end - buf, \u0022}\u005cn \u0022);\n+\tbuf +\u003d lws_snprintf(buf, end - buf, \u0022}\u005cn \u0022);\n \n \treturn buf - orig;\n }\ndiff --git a/lib/libwebsockets.h b/lib/libwebsockets.h\nindex ef9cd0f..5183090 100644\n--- a/lib/libwebsockets.h\n+++ b/lib/libwebsockets.h\n@@ -147,7 +147,7 @@ struct sockaddr_in;\n #define LWS_O_RDONLY _O_RDONLY\n \n #if !defined(_MSC_VER) || _MSC_VER \u003c 1900 /* Visual Studio 2015 already defines this in \u003cstdio.h\u003e */\n-#define snprintf _snprintf\n+#define lws_snprintf _snprintf\n #endif\n \n #ifndef __func__\n@@ -2190,6 +2190,20 @@ lws_ext_parse_options(const struct lws_extension *ext, struct lws *wsi,\n LWS_VISIBLE LWS_EXTERN void\n lws_set_allocator(void *(*realloc)(void *ptr, size_t size));\n \n+/**\n+ * lws_snprintf(): lws_snprintf that truncates the returned length too\n+ *\n+ * \u005cparam str: destination buffer\n+ * \u005cparam size: bytes left in destination buffer\n+ * \u005cparam format: format string\n+ * \u005cparam ...: args for format\n+ *\n+ * This lets you correctly truncate buffers by concatenating lengths, if you\n+ * reach the limit the reported length doesn't exceed the limit.\n+ */\n+LWS_VISIBLE LWS_EXTERN int\n+lws_snprintf(char *str, size_t size, const char *format, ...);\n+\n #ifdef __cplusplus\n }\n #endif\ndiff --git a/lib/lws-plat-unix.c b/lib/lws-plat-unix.c\nindex e26b041..b430a78 100644\n--- a/lib/lws-plat-unix.c\n+++ b/lib/lws-plat-unix.c\n@@ -331,7 +331,7 @@ lws_plat_plugins_init(struct lws_context * context, const char * const *d)\n \n \t\t\tlwsl_notice(\u0022 %s\u005cn\u0022, namelist[i]-\u003ed_name);\n \n-\t\t\tsnprintf(path, sizeof(path) - 1, \u0022%s/%s\u0022, *d,\n+\t\t\tlws_snprintf(path, sizeof(path) - 1, \u0022%s/%s\u0022, *d,\n \t\t\t\t namelist[i]-\u003ed_name);\n \t\t\tl \u003d dlopen(path, RTLD_NOW);\n \t\t\tif (!l) {\n@@ -341,7 +341,7 @@ lws_plat_plugins_init(struct lws_context * context, const char * const *d)\n \t\t\t\tgoto bail;\n \t\t\t}\n \t\t\t/* we could open it, can we get his init function? */\n-\t\t\tm \u003d snprintf(path, sizeof(path) - 1, \u0022init_%s\u0022,\n+\t\t\tm \u003d lws_snprintf(path, sizeof(path) - 1, \u0022init_%s\u0022,\n \t\t\t\t namelist[i]-\u003ed_name + 3 /* snip lib... */);\n \t\t\tpath[m - 3] \u003d '\u005c0'; /* snip the .so */\n \t\t\tinitfunc \u003d dlsym(l, path);\n@@ -406,7 +406,7 @@ lws_plat_plugins_destroy(struct lws_context * context)\n \n \twhile (plugin) {\n \t\tp \u003d plugin;\n-\t\tm \u003d snprintf(path, sizeof(path) - 1, \u0022destroy_%s\u0022, plugin-\u003ename + 3);\n+\t\tm \u003d lws_snprintf(path, sizeof(path) - 1, \u0022destroy_%s\u0022, plugin-\u003ename + 3);\n \t\tpath[m - 3] \u003d '\u005c0';\n \t\tfunc \u003d dlsym(plugin-\u003el, path);\n \t\tif (!func) {\ndiff --git a/lib/private-libwebsockets.h b/lib/private-libwebsockets.h\nindex 1a0792a..8102a73 100644\n--- a/lib/private-libwebsockets.h\n+++ b/lib/private-libwebsockets.h\n@@ -97,7 +97,7 @@\n #endif\n \n #ifdef LWS_HAVE__SNPRINTF\n-#define snprintf _snprintf\n+#define lws_snprintf _snprintf\n #endif\n \n #else /* not windows --\u003e */\ndiff --git a/lib/server.c b/lib/server.c\nindex 1ac3651..b7d5bf0 100644\n--- a/lib/server.c\n+++ b/lib/server.c\n@@ -301,7 +301,7 @@ lws_http_serve(struct lws *wsi, char *uri, const char *origin,\n #endif\n \tint n, spin \u003d 0;\n \n-\tsnprintf(path, sizeof(path) - 1, \u0022%s/%s\u0022, origin, uri);\n+\tlws_snprintf(path, sizeof(path) - 1, \u0022%s/%s\u0022, origin, uri);\n \n #ifndef _WIN32_WCE\n \tdo {\n@@ -322,12 +322,12 @@ lws_http_serve(struct lws *wsi, char *uri, const char *origin,\n \t\t\t}\n \t\t\tsym[len] \u003d '\u005c0';\n \t\t\tlwsl_debug(\u0022symlink %s -\u003e %s\u005cn\u0022, path, sym);\n-\t\t\tsnprintf(path, sizeof(path) - 1, \u0022%s\u0022, sym);\n+\t\t\tlws_snprintf(path, sizeof(path) - 1, \u0022%s\u0022, sym);\n \t\t}\n #endif\n \t\tif ((S_IFMT \u0026 st.st_mode) \u003d\u003d S_IFDIR) {\n \t\t\tlwsl_debug(\u0022default filename append to dir\u005cn\u0022);\n-\t\t\tsnprintf(path, sizeof(path) - 1, \u0022%s/%s/index.html\u0022,\n+\t\t\tlws_snprintf(path, sizeof(path) - 1, \u0022%s/%s/index.html\u0022,\n \t\t\t\t origin, uri);\n \t\t}\n \n@@ -601,7 +601,7 @@ lws_http_action(struct lws *wsi)\n \t\t\telse\n \t\t\t\tme \u003d \u0022unknown\u0022;\n \n-\t\t\tsnprintf(wsi-\u003eaccess_log.header_log, l,\n+\t\t\tlws_snprintf(wsi-\u003eaccess_log.header_log, l,\n \t\t\t\t \u0022%s - - [%s] \u005c\u0022%s %s %s\u005c\u0022\u0022,\n \t\t\t\t pa, da, me, uri_ptr,\n \t\t\t\t hver[wsi-\u003eu.http.request_version]);\n@@ -676,11 +676,11 @@ lws_http_action(struct lws *wsi)\n \n \t\t\t/* \u003e at start indicates deal with by redirect */\n \t\t\tif (hit-\u003eorigin_protocol \u0026 4)\n-\t\t\t\tn \u003d snprintf((char *)end, 256, \u0022%s%s\u0022,\n+\t\t\t\tn \u003d lws_snprintf((char *)end, 256, \u0022%s%s\u0022,\n \t\t\t\t\t oprot[hit-\u003eorigin_protocol \u0026 1],\n \t\t\t\t\t hit-\u003eorigin);\n \t\t\telse\n-\t\t\t\tn \u003d snprintf((char *)end, 256,\n+\t\t\t\tn \u003d lws_snprintf((char *)end, 256,\n \t\t\t\t \u0022https://%s/%s/\u0022,\n \t\t\t\t lws_hdr_simple_ptr(wsi, WSI_TOKEN_HOST),\n \t\t\t\t uri_ptr);\ndiff --git a/libwebsockets-api-doc.html b/libwebsockets-api-doc.html\nindex ee11371..a7b7197 100644\n--- a/libwebsockets-api-doc.html\n+++ b/libwebsockets-api-doc.html\n@@ -1923,3 +1923,27 @@ text/html content-encoding, it's replaced with \u003ctt\u003e\u003cb\u003euri_replace_to\u003c/b\u003e\u003c/tt\u003e\n \u003cdd\u003eLength of data in \u003ctt\u003e\u003cb\u003ebuf\u003c/b\u003e\u003c/tt\u003e to send\n \u003c/dl\u003e\n \u003chr\u003e\n+\u003ch2\u003elws_snprintf - \u003c/h2\u003e\n+\u003ci\u003eLWS_EXTERN int\u003c/i\u003e\n+\u003cb\u003elws_snprintf\u003c/b\u003e\n+(\u003ci\u003echar *\u003c/i\u003e \u003cb\u003estr\u003c/b\u003e,\n+\u003ci\u003esize_t\u003c/i\u003e \u003cb\u003esize\u003c/b\u003e,\n+\u003ci\u003econst char *\u003c/i\u003e \u003cb\u003eformat\u003c/b\u003e,\n+\u003ci\u003e\u003c/i\u003e \u003cb\u003e...\u003c/b\u003e)\n+\u003ch3\u003eArguments\u003c/h3\u003e\n+\u003cdl\u003e\n+\u003cdt\u003e\u003cb\u003e...\u003c/b\u003e\n+\u003cdd\u003evariable arguments\n+\u003c/dl\u003e\n+\u003ch3\u003eDescription\u003c/h3\u003e\n+\u003cblockquote\u003e\n+\u003cp\u003e\n+\u005cparam str: destination buffer\n+\u005cparam size: bytes left in destination buffer\n+\u005cparam format: format string\n+\u005cparam ...: args for format\n+\u003cp\u003e\n+This lets you correctly truncate buffers by concatenating lengths, if you\n+reach the limit the reported length doesn't exceed the limit.\n+\u003c/blockquote\u003e\n+\u003chr\u003e\ndiff --git a/lwsws/conf.c b/lwsws/conf.c\nindex fa00095..e0059b4 100644\n--- a/lwsws/conf.c\n+++ b/lwsws/conf.c\n@@ -181,7 +181,7 @@ lejp_globals_cb(struct lejp_ctx *ctx, char reason)\n \t\treturn 0;\n \t}\n \n-\ta-\u003ep +\u003d snprintf(a-\u003ep, a-\u003eend - a-\u003ep, \u0022%s\u0022, ctx-\u003ebuf);\n+\ta-\u003ep +\u003d lws_snprintf(a-\u003ep, a-\u003eend - a-\u003ep, \u0022%s\u0022, ctx-\u003ebuf);\n \n \treturn 0;\n }\n@@ -254,7 +254,7 @@ lejp_vhosts_cb(struct lejp_ctx *ctx, char reason)\n \t\ta-\u003ep +\u003d n;\n \t\ta-\u003epvo-\u003evalue \u003d a-\u003ep;\n \t\ta-\u003epvo-\u003eoptions \u003d NULL;\n-\t\ta-\u003ep +\u003d snprintf(a-\u003ep, a-\u003eend - a-\u003ep, \u0022%s\u0022, ctx-\u003ebuf);\n+\t\ta-\u003ep +\u003d lws_snprintf(a-\u003ep, a-\u003eend - a-\u003ep, \u0022%s\u0022, ctx-\u003ebuf);\n \t\t*(a-\u003ep)++ \u003d '\u005c0';\n \t}\n \n@@ -408,7 +408,7 @@ lejp_vhosts_cb(struct lejp_ctx *ctx, char reason)\n \t\ta-\u003ep +\u003d n;\n \t\tmp_cgienv-\u003evalue \u003d a-\u003ep;\n \t\tmp_cgienv-\u003eoptions \u003d NULL;\n-\t\ta-\u003ep +\u003d snprintf(a-\u003ep, a-\u003eend - a-\u003ep, \u0022%s\u0022, ctx-\u003ebuf);\n+\t\ta-\u003ep +\u003d lws_snprintf(a-\u003ep, a-\u003eend - a-\u003ep, \u0022%s\u0022, ctx-\u003ebuf);\n \t\t*(a-\u003ep)++ \u003d '\u005c0';\n \n \t\tlwsl_notice(\u0022 adding cgi-env '%s' \u003d '%s'\u005cn\u0022, mp_cgienv-\u003ename,\n@@ -452,7 +452,7 @@ lejp_vhosts_cb(struct lejp_ctx *ctx, char reason)\n \t\treturn 0;\n \t}\n \n-\ta-\u003ep +\u003d snprintf(a-\u003ep, a-\u003eend - a-\u003ep, \u0022%s\u0022, ctx-\u003ebuf);\n+\ta-\u003ep +\u003d lws_snprintf(a-\u003ep, a-\u003eend - a-\u003ep, \u0022%s\u0022, ctx-\u003ebuf);\n \t*(a-\u003ep)++ \u003d '\u005c0';\n \n \treturn 0;\n@@ -518,7 +518,7 @@ lwsws_get_config_d(void *user, const char *d, const char * const *paths,\n \t}\n \n \twhile (uv_fs_scandir_next(\u0026req, \u0026dent) !\u003d UV_EOF) {\n-\t\tsnprintf(path, sizeof(path) - 1, \u0022%s/%s\u0022, d, dent.name);\n+\t\tlws_snprintf(path, sizeof(path) - 1, \u0022%s/%s\u0022, d, dent.name);\n \t\tret \u003d lwsws_get_config(user, path, paths, count_paths, cb);\n \t\tif (ret)\n \t\t\tgoto bail;\n@@ -558,7 +558,7 @@ lwsws_get_config_d(void *user, const char *d, const char * const *paths,\n \t}\n \n \tfor (i \u003d 0; i \u003c n; i++) {\n-\t\tsnprintf(path, sizeof(path) - 1, \u0022%s/%s\u0022, d,\n+\t\tlws_snprintf(path, sizeof(path) - 1, \u0022%s/%s\u0022, d,\n \t\t\t namelist[i]-\u003ed_name);\n \t\tret \u003d lwsws_get_config(user, path, paths, count_paths, cb);\n \t\tif (ret) {\ndiff --git a/plugins/protocol_lws_status.c b/plugins/protocol_lws_status.c\nindex 29e1d65..c9d828f 100644\n--- a/plugins/protocol_lws_status.c\n+++ b/plugins/protocol_lws_status.c\n@@ -58,7 +58,7 @@ update_status(struct lws *wsi, struct per_session_data__lws_status *pss)\n \tstruct tm tm;\n #endif\n \n-\tp +\u003d snprintf(p, 512, \u0022 { %s, \u005c\u0022wsi\u005c\u0022:\u005c\u0022%d\u005c\u0022, \u005c\u0022conns\u005c\u0022:[\u0022,\n+\tp +\u003d lws_snprintf(p, 512, \u0022 { %s, \u005c\u0022wsi\u005c\u0022:\u005c\u0022%d\u005c\u0022, \u005c\u0022conns\u005c\u0022:[\u0022,\n \t\t server_info, live_wsi);\n \n \t/* render the list */\n@@ -79,7 +79,7 @@ update_status(struct lws *wsi, struct per_session_data__lws_status *pss)\n \t\tif (subsequent)\n \t\t\t*p++ \u003d ',';\n \t\tsubsequent \u003d 1;\n-\t\tp +\u003d snprintf(p, sizeof(cache) - (p - start) - 1,\n+\t\tp +\u003d lws_snprintf(p, sizeof(cache) - (p - start) - 1,\n \t\t\t\t\u0022{\u005c\u0022peer\u005c\u0022:\u005c\u0022%s\u005c\u0022,\u005c\u0022time\u005c\u0022:\u005c\u0022%s\u005c\u0022,\u0022\n \t\t\t\t\u0022\u005c\u0022ua\u005c\u0022:\u005c\u0022%s\u005c\u0022}\u0022,\n \t\t\t (*pp)-\u003eip, date, (*pp)-\u003euser_agent);\ndiff --git a/test-server/test-fraggle.c b/test-server/test-fraggle.c\nindex 2137e7b..80aaea5 100644\n--- a/test-server/test-fraggle.c\n+++ b/test-server/test-fraggle.c\n@@ -349,7 +349,7 @@ int main(int argc, char **argv)\n \t\tstruct lws_client_connect_info i;\n \n \t\taddress \u003d argv[optind];\n-\t\tsnprintf(ads_port, sizeof(ads_port), \u0022%s:%u\u0022,\n+\t\tlws_snprintf(ads_port, sizeof(ads_port), \u0022%s:%u\u0022,\n \t\t\t address, port \u0026 65535);\n \t\tmemset(\u0026i, 0, sizeof(i));\n \t\ti.context \u003d context;\ndiff --git a/test-server/test-ping.c b/test-server/test-ping.c\nindex 3d073d8..65ab942 100644\n--- a/test-server/test-ping.c\n+++ b/test-server/test-ping.c\n@@ -453,7 +453,7 @@ int main(int argc, char **argv)\n \t/* create client websockets using dumb increment protocol */\n \n \taddress \u003d argv[optind];\n-\tsnprintf(ads_port, sizeof(ads_port), \u0022%s:%u\u0022,\n+\tlws_snprintf(ads_port, sizeof(ads_port), \u0022%s:%u\u0022,\n \t\t address, port \u0026 65535);\n \tlwsl_notice(\u0022Connecting to %s...\u005cn\u0022, ads_port);\n \tmemset(\u0026i, 0, sizeof(i));\ndiff --git a/test-server/test-server-status.c b/test-server/test-server-status.c\nindex d85897b..50fe5bf 100644\n--- a/test-server/test-server-status.c\n+++ b/test-server/test-server-status.c\n@@ -42,7 +42,7 @@ update_status(struct lws *wsi, struct per_session_data__lws_status *pss)\n \tstruct tm tm;\n #endif\n \n-\tp +\u003d snprintf(p, 512, \u0022 { %s, \u005c\u0022wsi\u005c\u0022:\u005c\u0022%d\u005c\u0022, \u005c\u0022conns\u005c\u0022:[\u0022,\n+\tp +\u003d lws_snprintf(p, 512, \u0022 { %s, \u005c\u0022wsi\u005c\u0022:\u005c\u0022%d\u005c\u0022, \u005c\u0022conns\u005c\u0022:[\u0022,\n \t\t server_info, live_wsi);\n \n \t/* render the list */\n@@ -67,7 +67,7 @@ update_status(struct lws *wsi, struct per_session_data__lws_status *pss)\n \t\tif (subsequent)\n \t\t\t*p++ \u003d ',';\n \t\tsubsequent \u003d 1;\n-\t\tp +\u003d snprintf(p, sizeof(cache) - (p - start) - 1,\n+\t\tp +\u003d lws_snprintf(p, sizeof(cache) - (p - start) - 1,\n \t\t\t\t\u0022{\u005c\u0022peer\u005c\u0022:\u005c\u0022%s\u005c\u0022,\u005c\u0022time\u005c\u0022:\u005c\u0022%s\u005c\u0022,\u0022\n \t\t\t\t\u0022\u005c\u0022ua\u005c\u0022:\u005c\u0022%s\u005c\u0022}\u0022,\n \t\t\t (*pp)-\u003eip, date, (*pp)-\u003euser_agent);\n","s":{"c":1752653084,"u": 15465}}
],"g": 19846,"chitpc": 0,"ehitpc": 0,"indexed":0
,
"ab": 0, "si": 0, "db":0, "di":0, "sat":0, "lfc": "0000"}