FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
wazuh/src/shared/buffer_op.c at fuzzing · postech-compsec/wazuh · GitHub
postech-compsec
/
wazuh
Public
forked from
wazuh/wazuh
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
wazuh
/
src
/
shared
/
buffer_op.c
Copy path
More file actions
More file actions
Latest commit
History
History
History
46 lines (41 loc) · 1.17 KB
Breadcrumbs
wazuh
/
src
/
shared
/
buffer_op.c
Copy path
File metadata and controls
46 lines (41 loc) · 1.17 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/*
* Copyright (C) 2015, Wazuh Inc.
* November, 2020.
*
* This program is free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
* License (version 2) as published by the FSF - Free Software
* Foundation.
*/
#include
"../headers/shared.h"
buffer_t
*
buffer_initialize
(
const
size_t
size
){
buffer_t
*
buffer
;
os_calloc
(
1
,
sizeof
(
buffer_t
),
buffer
);
os_calloc
(
size
,
sizeof
(
char
),
buffer
->
data
);
buffer
->
size
=
size
;
buffer
->
used
=
0
;
buffer
->
status
=
TRUE;
return
buffer
;
}
void
buffer_push
(
buffer_t
*
const
buffer
,
const
char
*
const
src
,
const
size_t
src_size
) {
if
(
NULL
!=
buffer
) {
if
(
NULL
!=
src
) {
if
((
buffer
->
size
-
buffer
->
used
)
>
src_size
&&
NULL
!=
buffer
->
data
) {
memcpy
(
buffer
->
data
+
buffer
->
used
,
src
,
src_size
);
buffer
->
used
+=
src_size
;
}
else
{
buffer
->
status
=
FALSE;
}
}
else
{
buffer
->
status
=
FALSE;
}
}
}
void
buffer_free
(
buffer_t
*
buffer
) {
if
(
NULL
!=
buffer
) {
if
(
buffer
->
data
) {
os_free
(
buffer
->
data
);
}
os_free
(
buffer
);
}
}
Back
|
FazBrowse Home
|
New Git URL