Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
frama-c
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
pub
frama-c
Commits
a8a94c1c
Commit
a8a94c1c
authored
2 years ago
by
Andre Maroneze
Committed by
David Bühler
2 years ago
Browse files
Options
Downloads
Patches
Plain Diff
[libc] add _SS_MAXSIZE and fix stub for recvfrom
parent
6d04c2ba
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
share/libc/sys/socket.c
+4
-5
4 additions, 5 deletions
share/libc/sys/socket.c
share/libc/sys/socket.h
+4
-0
4 additions, 0 deletions
share/libc/sys/socket.h
with
8 additions
and
5 deletions
share/libc/sys/socket.c
+
4
−
5
View file @
a8a94c1c
...
@@ -90,15 +90,14 @@ ssize_t recvfrom(int sockfd, void *buf, size_t len, int flags,
...
@@ -90,15 +90,14 @@ ssize_t recvfrom(int sockfd, void *buf, size_t len, int flags,
// non-error
// non-error
((
char
*
)
buf
)[
Frama_C_interval
(
0
,
len
-
1
)]
=
Frama_C_interval
(
0
,
255
);
((
char
*
)
buf
)[
Frama_C_interval
(
0
,
len
-
1
)]
=
Frama_C_interval
(
0
,
255
);
if
(
addrbuf
)
{
if
(
addrbuf
)
{
// simulate writing source address
Frama_C_make_unknown
((
char
*
)
addrbuf
,
*
addrbuf_len
);
socklen_t
addrlen
=
*
addrbuf_len
>
sizeof
(
struct
sockaddr
)
?
*
addrbuf_len
:
sizeof
(
struct
sockaddr
);
Frama_C_make_unknown
((
char
*
)
addrbuf
,
addrlen
);
/* From the "Linux Programmer's Manual:
/* From the "Linux Programmer's Manual:
"Upon return, 'addrbuf_len' is updated to contain the actual size of
"Upon return, 'addrbuf_len' is updated to contain the actual size of
the source address. The returned address is truncated if the buffer
the source address. The returned address is truncated if the buffer
provided is too small; in this case, 'addrbuf_len' will return a value
provided is too small; in this case, 'addrbuf_len' will return a value
greater than was supplied to the call. */
greater than was supplied to the call."
*
addrbuf_len
=
addrlen
;
Here we use _SS_MAXSIZE as the maximum address struct size. */
*
addrbuf_len
=
Frama_C_unsigned_int_interval
(
0
,
_SS_MAXSIZE
);
}
}
return
Frama_C_long_interval
(
0
,
len
);
return
Frama_C_long_interval
(
0
,
len
);
}
}
...
...
This diff is collapsed.
Click to expand it.
share/libc/sys/socket.h
+
4
−
0
View file @
a8a94c1c
...
@@ -42,8 +42,12 @@ typedef __UINT_LEAST32_T socklen_t;
...
@@ -42,8 +42,12 @@ typedef __UINT_LEAST32_T socklen_t;
#include
"../__fc_define_ssize_t.h"
#include
"../__fc_define_ssize_t.h"
#include
"../features.h"
#include
"../features.h"
// Non-POSIX; value taken from Linux implementation
#define _SS_MAXSIZE 128
struct
sockaddr_storage
{
struct
sockaddr_storage
{
sa_family_t
ss_family
;
sa_family_t
ss_family
;
char
__sa_data
[
_SS_MAXSIZE
-
sizeof
(
sa_family_t
)];
/* non-POSIX */
};
};
#include
"./uio.h"
#include
"./uio.h"
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment