Skip to content

Commit 8bee2f6

Browse files
committed
standalone/AdsLib: allow AdsWrite for zero length buffer
We have at least one usecase for AdsSyncWriteReqEx() called with a nullptr buffer and zero length. ADSIGRP_EXTERNALTIME[1] uses this and encodes the actual command within the IndexOffset. AdsSyncReadWriteReqEx2() already uses the same pattern to check the pointer only if the bufferLength is non zero. So we adapt the same behaviour for AdsSyncWriteReqEx(). [1] https://infosys.beckhoff.com/content/1033/tc3_grundlagen/6313305611.html Fixes: #264 Signed-off-by: Patrick Bruenn <p.bruenn@beckhoff.com>
1 parent 9dcf5d9 commit 8bee2f6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

AdsLib/standalone/AdsLib.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ long AdsSyncWriteReqEx(long port, const AmsAddr *pAddr, uint32_t indexGroup,
182182
const void *buffer)
183183
{
184184
ASSERT_PORT_AND_AMSADDR(port, pAddr);
185-
if (!buffer) {
185+
if (bufferLength && !buffer) {
186186
return ADSERR_CLIENT_INVALIDPARM;
187187
}
188188

0 commit comments

Comments
 (0)