mirror of
https://github.com/warmcat/libwebsockets.git
synced 2025-03-23 00:00:06 +01:00
66 lines
No EOL
3.8 KiB
TeX
66 lines
No EOL
3.8 KiB
TeX
\hypertarget{group__pur}{}\section{Sanitize / purify S\+QL and J\+S\+ON helpers}
|
|
\label{group__pur}\index{Sanitize / purify S\+Q\+L and J\+S\+O\+N helpers@{Sanitize / purify S\+Q\+L and J\+S\+O\+N helpers}}
|
|
\subsection*{Functions}
|
|
\begin{DoxyCompactItemize}
|
|
\item
|
|
L\+W\+S\+\_\+\+V\+I\+S\+I\+B\+LE L\+W\+S\+\_\+\+E\+X\+T\+E\+RN const char $\ast$ \hyperlink{group__pur_ga9cc82f06e5ae7e71458626d7a39a5865}{lws\+\_\+sql\+\_\+purify} (char $\ast$escaped, const char $\ast$string, int len)
|
|
\item
|
|
L\+W\+S\+\_\+\+V\+I\+S\+I\+B\+LE L\+W\+S\+\_\+\+E\+X\+T\+E\+RN const char $\ast$ \hyperlink{group__pur_gab15187efcfa256b7c928562c182b92a3}{lws\+\_\+json\+\_\+purify} (char $\ast$escaped, const char $\ast$string, int len)
|
|
\end{DoxyCompactItemize}
|
|
|
|
|
|
\subsection{Detailed Description}
|
|
\subsubsection*{Sanitize / purify S\+QL and J\+S\+ON helpers}
|
|
|
|
A\+P\+Is for escaping untrusted J\+S\+ON and S\+QL safely before use
|
|
|
|
\subsection{Function Documentation}
|
|
\index{Sanitize / purify S\+Q\+L and J\+S\+O\+N helpers@{Sanitize / purify S\+Q\+L and J\+S\+O\+N helpers}!lws\+\_\+json\+\_\+purify@{lws\+\_\+json\+\_\+purify}}
|
|
\index{lws\+\_\+json\+\_\+purify@{lws\+\_\+json\+\_\+purify}!Sanitize / purify S\+Q\+L and J\+S\+O\+N helpers@{Sanitize / purify S\+Q\+L and J\+S\+O\+N helpers}}
|
|
\subsubsection[{\texorpdfstring{lws\+\_\+json\+\_\+purify(char $\ast$escaped, const char $\ast$string, int len)}{lws\_json\_purify(char *escaped, const char *string, int len)}}]{\setlength{\rightskip}{0pt plus 5cm}L\+W\+S\+\_\+\+V\+I\+S\+I\+B\+LE L\+W\+S\+\_\+\+E\+X\+T\+E\+RN const char$\ast$ lws\+\_\+json\+\_\+purify (
|
|
\begin{DoxyParamCaption}
|
|
\item[{char $\ast$}]{escaped, }
|
|
\item[{const char $\ast$}]{string, }
|
|
\item[{int}]{len}
|
|
\end{DoxyParamCaption}
|
|
)}\hypertarget{group__pur_gab15187efcfa256b7c928562c182b92a3}{}\label{group__pur_gab15187efcfa256b7c928562c182b92a3}
|
|
|
|
|
|
{\ttfamily \#include $<$\hyperlink{libwebsockets_8h}{lib/libwebsockets.\+h}$>$}
|
|
|
|
\hyperlink{group__pur_gab15187efcfa256b7c928562c182b92a3}{lws\+\_\+json\+\_\+purify()} -\/ like strncpy but with escaping for json chars
|
|
|
|
|
|
\begin{DoxyParams}{Parameters}
|
|
{\em escaped} & output buffer \\
|
|
\hline
|
|
{\em string} & input buffer (\textquotesingle{}/0\textquotesingle{} terminated) \\
|
|
\hline
|
|
{\em len} & output buffer max length\\
|
|
\hline
|
|
\end{DoxyParams}
|
|
Because escaping expands the output string, it\textquotesingle{}s not possible to do it in-\/place, ie, with escaped == string \index{Sanitize / purify S\+Q\+L and J\+S\+O\+N helpers@{Sanitize / purify S\+Q\+L and J\+S\+O\+N helpers}!lws\+\_\+sql\+\_\+purify@{lws\+\_\+sql\+\_\+purify}}
|
|
\index{lws\+\_\+sql\+\_\+purify@{lws\+\_\+sql\+\_\+purify}!Sanitize / purify S\+Q\+L and J\+S\+O\+N helpers@{Sanitize / purify S\+Q\+L and J\+S\+O\+N helpers}}
|
|
\subsubsection[{\texorpdfstring{lws\+\_\+sql\+\_\+purify(char $\ast$escaped, const char $\ast$string, int len)}{lws\_sql\_purify(char *escaped, const char *string, int len)}}]{\setlength{\rightskip}{0pt plus 5cm}L\+W\+S\+\_\+\+V\+I\+S\+I\+B\+LE L\+W\+S\+\_\+\+E\+X\+T\+E\+RN const char$\ast$ lws\+\_\+sql\+\_\+purify (
|
|
\begin{DoxyParamCaption}
|
|
\item[{char $\ast$}]{escaped, }
|
|
\item[{const char $\ast$}]{string, }
|
|
\item[{int}]{len}
|
|
\end{DoxyParamCaption}
|
|
)}\hypertarget{group__pur_ga9cc82f06e5ae7e71458626d7a39a5865}{}\label{group__pur_ga9cc82f06e5ae7e71458626d7a39a5865}
|
|
|
|
|
|
{\ttfamily \#include $<$\hyperlink{libwebsockets_8h}{lib/libwebsockets.\+h}$>$}
|
|
|
|
\hyperlink{group__pur_ga9cc82f06e5ae7e71458626d7a39a5865}{lws\+\_\+sql\+\_\+purify()} -\/ like strncpy but with escaping for sql quotes
|
|
|
|
|
|
\begin{DoxyParams}{Parameters}
|
|
{\em escaped} & output buffer \\
|
|
\hline
|
|
{\em string} & input buffer (\textquotesingle{}/0\textquotesingle{} terminated) \\
|
|
\hline
|
|
{\em len} & output buffer max length\\
|
|
\hline
|
|
\end{DoxyParams}
|
|
Because escaping expands the output string, it\textquotesingle{}s not possible to do it in-\/place, ie, with escaped == string |