File tree 4 files changed +25
-17
lines changed
4 files changed +25
-17
lines changed Original file line number Diff line number Diff line change 31
31
#else
32
32
#include "alt/range2random_glib.h"
33
33
#endif
34
- #include "ticket .h"
34
+ #include "booth .h"
35
35
#include "config.h"
36
- #include "pacemaker .h"
36
+ #include "handler .h"
37
37
#include "inline-fn.h"
38
38
#include "log.h"
39
- #include "booth.h"
39
+ #include "manual.h"
40
+ #include "pacemaker.h"
40
41
#include "raft.h"
41
- #include "handler.h"
42
42
#include "request.h"
43
- #include "manual.h"
43
+ #include "ticket.h"
44
+ #include "utils.h"
44
45
45
46
#define TK_LINE 256
46
47
47
48
extern int TIME_RES ;
48
49
49
- /* Untrusted input, must fit (incl. \0) in a buffer of max chars. */
50
- int check_max_len_valid (const char * s , int max )
51
- {
52
- int i ;
53
- for (i = 0 ; i < max ; i ++ )
54
- if (s [i ] == 0 )
55
- return 1 ;
56
- return 0 ;
57
- }
58
-
59
50
int find_ticket_by_name (struct booth_config * conf_ptr ,
60
51
const char * ticket , struct ticket_config * * found )
61
52
{
Original file line number Diff line number Diff line change @@ -164,8 +164,6 @@ void update_ticket_state(struct booth_config *conf_ptr,
164
164
*/
165
165
int setup_ticket (struct booth_config * conf_ptr );
166
166
167
- int check_max_len_valid (const char * s , int max );
168
-
169
167
/**
170
168
* @internal
171
169
* Pick a ticket structure based on given name
Original file line number Diff line number Diff line change 11
11
#include <stdlib.h> /* fprintf */
12
12
#include <string.h> /* strlen, strncpy */
13
13
14
+ int check_max_len_valid (const char * s , size_t max )
15
+ {
16
+ for (size_t i = 0 ; i < max ; i ++ )
17
+ if (s [i ] == '\0' )
18
+ return 1 ;
19
+ return 0 ;
20
+ }
21
+
14
22
void safe_copy (char * dest , const char * value , size_t buflen ,
15
23
const char * description )
16
24
{
Original file line number Diff line number Diff line change 9
9
10
10
#include <stdlib.h> /* size_t */
11
11
12
+ /**
13
+ * @internal
14
+ * For an untrusted string, check that it terminates in @p max initial bytes
15
+ *
16
+ * @param[in] s string at input
17
+ * @param[in] max delimits the termination seeking this big initial chunk
18
+ *
19
+ * @return 1 if early termination satisified, 0 if not
20
+ */
21
+ int check_max_len_valid (const char * s , size_t max );
22
+
12
23
/**
13
24
* @internal
14
25
* Like strncpy, but with explicit protection and better diagnostics
You can’t perform that action at this time.
0 commit comments