You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@netbeans.apache.org by "Yiyuan GUO (Jira)" <ji...@apache.org> on 2021/05/27 10:50:00 UTC

[jira] [Updated] (NETBEANS-5718) A divide by zero bug in websocket

     [ https://issues.apache.org/jira/browse/NETBEANS-5718?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Yiyuan GUO updated NETBEANS-5718:
---------------------------------
    Priority: Critical  (was: Major)

> A divide by zero bug in websocket
> ---------------------------------
>
>                 Key: NETBEANS-5718
>                 URL: https://issues.apache.org/jira/browse/NETBEANS-5718
>             Project: NetBeans
>          Issue Type: Bug
>            Reporter: Yiyuan GUO
>            Priority: Critical
>              Labels: security
>
> In the file[ webcommon/netserver/src/org/netbeans/modules/netserver/websocket/Utils.java|https://github.com/apache/netbeans/blob/39496d3400eada7398a8428f05c90589aa1f3b74/webcommon/netserver/src/org/netbeans/modules/netserver/websocket/Utils.java], the method _decodeNumber_ has the following [code|https://github.com/apache/netbeans/blob/39496d3400eada7398a8428f05c90589aa1f3b74/webcommon/netserver/src/org/netbeans/modules/netserver/websocket/Utils.java#L213]:
> {code:java}
> private static int decodeNumber(String code) {
>     long number = 0;
>     int spaces = 0;
>     for (int i=0; i<code.length(); i++) {
>         char c = code.charAt(i);
>         if (c >= '0' && c <= '9') {
>             number *= 10;
>             number += (c-'0');
>         }
>         if (c == ' ') {
>             spaces++;
>         }
>     }
>     return (int)(number/spaces);
> }
> {code}
> If the variable _code_ contains no spaces, a divide by zero will happen when performing the division:
> {code:java}
> return (int)(number/spaces);
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@netbeans.apache.org
For additional commands, e-mail: commits-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists