Troepje commented on code in PR #494:
URL: https://github.com/apache/celix/pull/494#discussion_r1133073349


##########
bundles/pubsub/pubsub_admin_websocket/src/pubsub_websocket_topic_receiver.c:
##########
@@ -146,10 +147,13 @@ pubsub_websocket_topic_receiver_t* 
pubsub_websocketTopicReceiver_create(celix_bu
 
     receiver->uri = psa_websocket_createURI(scope, topic);
 
-    // Set receiver connection thread timeout.
-    // property is in ms, timeout value in us. (convert ms to us).
-    receiver->timeout = celix_bundleContext_getPropertyAsLong(ctx, 
PSA_WEBSOCKET_SUBSCRIBER_CONNECTION_TIMEOUT,
-                                                              
PSA_WEBSOCKET_SUBSCRIBER_CONNECTION_DEFAULT_TIMEOUT) * 1000;
+    long timeoutMs = celix_bundleContext_getPropertyAsLong(ctx, 
PSA_WEBSOCKET_SUBSCRIBER_CONNECTION_TIMEOUT,
+                                                                
PSA_WEBSOCKET_SUBSCRIBER_CONNECTION_DEFAULT_TIMEOUT);
+    receiver->timeoutUs = (useconds_t)((
+            ((timeoutMs < 0) || (timeoutMs > INT_MAX))            // Protect 
against under and overflow

Review Comment:
   Im sorry, I was trying to go to quick, thanks for spotting it!



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to