Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
a96e118d
Commit
a96e118d
authored
May 16, 2008
by
Juan Lang
Committed by
Alexandre Julliard
May 19, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
snmpapi: Test and correct SnmpUtilOidNCmp when Oid lengths don't match.
parent
d88ee55e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
2 deletions
+15
-2
main.c
dlls/snmpapi/main.c
+6
-2
util.c
dlls/snmpapi/tests/util.c
+9
-0
No files found.
dlls/snmpapi/main.c
View file @
a96e118d
...
...
@@ -343,17 +343,21 @@ VOID WINAPI SnmpUtilOidFree(AsnObjectIdentifier *oid)
*/
INT
WINAPI
SnmpUtilOidNCmp
(
AsnObjectIdentifier
*
oid1
,
AsnObjectIdentifier
*
oid2
,
UINT
count
)
{
unsigned
int
i
;
unsigned
int
i
,
len
;
TRACE
(
"(%p, %p, %d)
\n
"
,
oid1
,
oid2
,
count
);
if
(
!
oid1
||
!
oid2
)
return
0
;
for
(
i
=
0
;
i
<
count
;
i
++
)
len
=
min
(
count
,
oid1
->
idLength
);
len
=
min
(
len
,
oid2
->
idLength
);
for
(
i
=
0
;
i
<
len
;
i
++
)
{
if
(
oid1
->
ids
[
i
]
>
oid2
->
ids
[
i
])
return
1
;
if
(
oid1
->
ids
[
i
]
<
oid2
->
ids
[
i
])
return
-
1
;
}
if
(
oid1
->
idLength
<
oid2
->
idLength
)
return
-
1
;
if
(
oid1
->
idLength
>
oid2
->
idLength
)
return
1
;
return
0
;
}
...
...
dlls/snmpapi/tests/util.c
View file @
a96e118d
...
...
@@ -321,6 +321,15 @@ static void test_SnmpUtilOidNCmp(void)
ret
=
SnmpUtilOidNCmp
(
&
oid2
,
&
oid1
,
4
);
ok
(
ret
==
1
,
"SnmpUtilOidNCmp failed: %d
\n
"
,
ret
);
oid1
.
idLength
=
3
;
memcpy
(
oid1
.
ids
,
oid2
.
ids
,
sizeof
(
UINT
)
*
4
);
ret
=
SnmpUtilOidNCmp
(
&
oid1
,
&
oid1
,
4
);
ok
(
!
ret
,
"SnmpUtilOidNCmp failed: %d
\n
"
,
ret
);
ret
=
SnmpUtilOidNCmp
(
&
oid2
,
&
oid1
,
4
);
ok
(
ret
==
1
,
"SnmpUtilOidNCmp failed: %d
\n
"
,
ret
);
ret
=
SnmpUtilOidNCmp
(
&
oid1
,
&
oid2
,
4
);
ok
(
ret
==
-
1
,
"SnmpUtilOidNCmp failed: %d
\n
"
,
ret
);
}
static
void
test_SnmpUtilOidCmp
(
void
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment