aboutsummaryrefslogtreecommitdiffstats
path: root/src/blogc-git-receiver
diff options
context:
space:
mode:
authorRafael G. Martins <rafael@rafaelmartins.eng.br>2020-05-30 21:08:16 +0200
committerRafael G. Martins <rafael@rafaelmartins.eng.br>2020-05-30 21:08:16 +0200
commit9a3629921b250e7079be9abb5252381025c33354 (patch)
treeefba39ef18c690566e2bff423a1125d871d0e1f8 /src/blogc-git-receiver
parent30c3bd35de3b7c0f5dc22259fdef9194f10f74a4 (diff)
downloadblogc-9a3629921b250e7079be9abb5252381025c33354.tar.gz
blogc-9a3629921b250e7079be9abb5252381025c33354.tar.bz2
blogc-9a3629921b250e7079be9abb5252381025c33354.zip
git-receiver: pre-receive parser should accept len
Diffstat (limited to 'src/blogc-git-receiver')
-rw-r--r--src/blogc-git-receiver/pre-receive-parser.c4
-rw-r--r--src/blogc-git-receiver/pre-receive-parser.h4
-rw-r--r--src/blogc-git-receiver/pre-receive.c2
3 files changed, 6 insertions, 4 deletions
diff --git a/src/blogc-git-receiver/pre-receive-parser.c b/src/blogc-git-receiver/pre-receive-parser.c
index fb4c4d5..a5d1e8d 100644
--- a/src/blogc-git-receiver/pre-receive-parser.c
+++ b/src/blogc-git-receiver/pre-receive-parser.c
@@ -6,6 +6,7 @@
* See the file LICENSE.
*/
+#include <stddef.h>
#include <stdlib.h>
#include <string.h>
#include "../common/utils.h"
@@ -22,12 +23,11 @@ typedef enum {
char*
-bgr_pre_receive_parse(const char *input)
+bgr_pre_receive_parse(const char *input, size_t input_len)
{
input_state_t state = START_OLD;
size_t start = 0;
size_t start_new = 0;
- size_t input_len = strlen(input);
for (size_t current = 0; current < input_len; current++) {
diff --git a/src/blogc-git-receiver/pre-receive-parser.h b/src/blogc-git-receiver/pre-receive-parser.h
index 7a011a7..e5a392a 100644
--- a/src/blogc-git-receiver/pre-receive-parser.h
+++ b/src/blogc-git-receiver/pre-receive-parser.h
@@ -9,6 +9,8 @@
#ifndef _PRE_RECEIVE_PARSER_H
#define _PRE_RECEIVE_PARSER_H
-char* bgr_pre_receive_parse(const char *input);
+#include <stddef.h>
+
+char* bgr_pre_receive_parse(const char *input, size_t input_len);
#endif /* _PRE_RECEIVE_PARSER_H */
diff --git a/src/blogc-git-receiver/pre-receive.c b/src/blogc-git-receiver/pre-receive.c
index 107459e..76cf1bf 100644
--- a/src/blogc-git-receiver/pre-receive.c
+++ b/src/blogc-git-receiver/pre-receive.c
@@ -171,7 +171,7 @@ default_sym:
}
else {
char *input = bc_stdin_read();
- master = bgr_pre_receive_parse(input);
+ master = bgr_pre_receive_parse(input, strlen(input));
free(input);
}