@@ -239,24 +239,24 @@ static int shadow_topics_construct(const char *const client_id)
239239 int index = 0 ;
240240
241241 err = snprintk (get_topic , sizeof (get_topic ), GET_TOPIC , client_id );
242- if ((err < 0 ) && (err >= GET_TOPIC_LEN )) {
242+ if ((err < 0 ) || (err >= GET_TOPIC_LEN )) {
243243 return - ENOMEM ;
244244 }
245245
246246 err = snprintk (update_topic , sizeof (update_topic ), UPDATE_TOPIC , client_id );
247- if ((err < 0 ) && (err >= UPDATE_TOPIC_LEN )) {
247+ if ((err < 0 ) || (err >= UPDATE_TOPIC_LEN )) {
248248 return - ENOMEM ;
249249 }
250250
251251 err = snprintk (delete_topic , sizeof (delete_topic ), DELETE_TOPIC , client_id );
252- if ((err < 0 ) && (err >= DELETE_TOPIC_LEN )) {
252+ if ((err < 0 ) || (err >= DELETE_TOPIC_LEN )) {
253253 return - ENOMEM ;
254254 }
255255
256256 if (IS_ENABLED (CONFIG_AWS_IOT_TOPIC_GET_ACCEPTED_SUBSCRIBE )) {
257257 err = snprintk (get_accepted_topic , sizeof (get_accepted_topic ),
258258 GET_ACCEPTED_TOPIC , client_id );
259- if ((err < 0 ) && (err >= GET_ACCEPTED_TOPIC_LEN )) {
259+ if ((err < 0 ) || (err >= GET_ACCEPTED_TOPIC_LEN )) {
260260 return - ENOMEM ;
261261 }
262262
@@ -270,7 +270,7 @@ static int shadow_topics_construct(const char *const client_id)
270270 if (IS_ENABLED (CONFIG_AWS_IOT_TOPIC_GET_REJECTED_SUBSCRIBE )) {
271271 err = snprintk (get_rejected_topic , sizeof (get_rejected_topic ),
272272 GET_REJECTED_TOPIC , client_id );
273- if ((err < 0 ) && (err >= GET_REJECTED_TOPIC_LEN )) {
273+ if ((err < 0 ) || (err >= GET_REJECTED_TOPIC_LEN )) {
274274 return - ENOMEM ;
275275 }
276276
@@ -284,7 +284,7 @@ static int shadow_topics_construct(const char *const client_id)
284284 if (IS_ENABLED (CONFIG_AWS_IOT_TOPIC_UPDATE_ACCEPTED_SUBSCRIBE )) {
285285 err = snprintk (update_accepted_topic , sizeof (update_accepted_topic ),
286286 UPDATE_ACCEPTED_TOPIC , client_id );
287- if ((err < 0 ) && (err >= UPDATE_ACCEPTED_TOPIC_LEN )) {
287+ if ((err < 0 ) || (err >= UPDATE_ACCEPTED_TOPIC_LEN )) {
288288 return - ENOMEM ;
289289 }
290290
@@ -298,7 +298,7 @@ static int shadow_topics_construct(const char *const client_id)
298298 if (IS_ENABLED (CONFIG_AWS_IOT_TOPIC_UPDATE_REJECTED_SUBSCRIBE )) {
299299 err = snprintk (update_rejected_topic , sizeof (update_rejected_topic ),
300300 UPDATE_REJECTED_TOPIC , client_id );
301- if ((err < 0 ) && (err >= UPDATE_REJECTED_TOPIC_LEN )) {
301+ if ((err < 0 ) || (err >= UPDATE_REJECTED_TOPIC_LEN )) {
302302 return - ENOMEM ;
303303 }
304304
@@ -312,7 +312,7 @@ static int shadow_topics_construct(const char *const client_id)
312312 if (IS_ENABLED (CONFIG_AWS_IOT_TOPIC_UPDATE_DELTA_SUBSCRIBE )) {
313313 err = snprintk (update_delta_topic , sizeof (update_delta_topic ),
314314 UPDATE_DELTA_TOPIC , client_id );
315- if ((err < 0 ) && (err >= UPDATE_DELTA_TOPIC_LEN )) {
315+ if ((err < 0 ) || (err >= UPDATE_DELTA_TOPIC_LEN )) {
316316 return - ENOMEM ;
317317 }
318318
@@ -326,7 +326,7 @@ static int shadow_topics_construct(const char *const client_id)
326326 if (IS_ENABLED (CONFIG_AWS_IOT_TOPIC_DELETE_ACCEPTED_SUBSCRIBE )) {
327327 err = snprintk (delete_accepted_topic , sizeof (delete_accepted_topic ),
328328 DELETE_ACCEPTED_TOPIC , client_id );
329- if ((err < 0 ) && (err >= DELETE_ACCEPTED_TOPIC_LEN )) {
329+ if ((err < 0 ) || (err >= DELETE_ACCEPTED_TOPIC_LEN )) {
330330 return - ENOMEM ;
331331 }
332332
@@ -340,7 +340,7 @@ static int shadow_topics_construct(const char *const client_id)
340340 if (IS_ENABLED (CONFIG_AWS_IOT_TOPIC_DELETE_REJECTED_SUBSCRIBE )) {
341341 err = snprintk (delete_rejected_topic , sizeof (delete_rejected_topic ),
342342 DELETE_REJECTED_TOPIC , client_id );
343- if ((err < 0 ) && (err >= DELETE_REJECTED_TOPIC_LEN )) {
343+ if ((err < 0 ) || (err >= DELETE_REJECTED_TOPIC_LEN )) {
344344 return - ENOMEM ;
345345 }
346346
0 commit comments