Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
M
micropython
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
card10
micropython
Commits
95b35206
Commit
95b35206
authored
9 years ago
by
Anmol Sarma
Browse files
Options
Downloads
Patches
Plain Diff
unix/modsocket: Fix usage of pointers to locals outside scope
parent
24652228
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
unix/modsocket.c
+3
-2
3 additions, 2 deletions
unix/modsocket.c
with
3 additions
and
2 deletions
unix/modsocket.c
+
3
−
2
View file @
95b35206
...
...
@@ -266,8 +266,9 @@ STATIC mp_obj_t socket_setsockopt(mp_uint_t n_args, const mp_obj_t *args) {
const
void
*
optval
;
socklen_t
optlen
;
int
val
;
if
(
MP_OBJ_IS_INT
(
args
[
3
]))
{
int
val
=
mp_obj_int_get_truncated
(
args
[
3
]);
val
=
mp_obj_int_get_truncated
(
args
[
3
]);
optval
=
&
val
;
optlen
=
sizeof
(
val
);
}
else
{
...
...
@@ -428,12 +429,12 @@ STATIC mp_obj_t mod_socket_getaddrinfo(mp_uint_t n_args, const mp_obj_t *args) {
const
char
*
host
=
mp_obj_str_get_str
(
args
[
0
]);
const
char
*
serv
=
NULL
;
struct
addrinfo
hints
;
char
buf
[
6
];
memset
(
&
hints
,
0
,
sizeof
(
hints
));
// getaddrinfo accepts port in string notation, so however
// it may seem stupid, we need to convert int to str
if
(
MP_OBJ_IS_SMALL_INT
(
args
[
1
]))
{
unsigned
port
=
(
unsigned
short
)
MP_OBJ_SMALL_INT_VALUE
(
args
[
1
]);
char
buf
[
6
];
sprintf
(
buf
,
"%u"
,
port
);
serv
=
buf
;
hints
.
ai_flags
=
AI_NUMERICSERV
;
...
...
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