Prechádzať zdrojové kódy

Check if we have enough place to add quotes

Kira-sempai 11 rokov pred
rodič
commit
079e6a5b9e
1 zmenil súbory, kde vykonal 1 pridanie a 0 odobranie
  1. 1 0
      frozen.c

+ 1 - 0
frozen.c

@@ -360,6 +360,7 @@ int json_emit_double(char *buf, int buf_len, double value) {
 }
 }
 
 
 int json_emit_quoted_str(char *buf, int buf_len, const char *str) {
 int json_emit_quoted_str(char *buf, int buf_len, const char *str) {
+  if (buf_len <= 1) return 0;
   int i = 0, j = 0, ch;
   int i = 0, j = 0, ch;
 
 
 #define EMIT(x) do { if (j < buf_len) buf[j++] = x; } while (0)
 #define EMIT(x) do { if (j < buf_len) buf[j++] = x; } while (0)