test_parser.c.diff

application/octet-stream

Filename: test_parser.c.diff
Type: application/octet-stream
Part: 0
Message: Buffer overflow in contrib/test_parser/test_parser.c

Patch

Same data as JSON: GET /api/v1/attachments/:id/patch the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes. API reference →
Format: unified
File+
contrib/test_parser/test_parser.c 4 4
diff --git a/contrib/test_parser/test_parser.c b/contrib/test_parser/test_parser.c
index c27d7d3..9b824eb 100644
--- a/contrib/test_parser/test_parser.c
+++ b/contrib/test_parser/test_parser.c
@@ -83,8 +83,8 @@
 		/* blank type */
 		type = 12;
 		/* go to the next non-white-space character */
-		while ((pst->buffer)[pst->pos] == ' ' &&
-			   pst->pos < pst->len)
+		while (pst->pos < pst->len &&
+			   (pst->buffer)[pst->pos] == ' ')
 			(pst->pos)++;
 	}
 	else
@@ -92,8 +92,8 @@
 		/* word type */
 		type = 3;
 		/* go to the next white-space character */
-		while ((pst->buffer)[pst->pos] != ' ' &&
-			   pst->pos < pst->len)
+		while (pst->pos < pst->len &&
+			   (pst->buffer)[pst->pos] != ' ')
 			(pst->pos)++;
 	}