如何编码流

时间:2016-01-04 17:27:32

标签: c# stream xss

我最近对我的代码进行了审核,确定了一些跨站点脚本漏洞。一些漏洞涉及使用" Stream.Write"。我在下面提供了一个例子,我假设有问题的行需要以某种方式进行编码,但我不知道该怎么做。有什么建议吗?

public class EncryptedStream : Stream
    {
        private Stream dataStream;

        private void MoveToOffset(long newPosition, bool forceRefresh)
        {
            // XSS vulnerability
            this.dataStream.Write(this.contentBuffer, 0, this.contentBuffer.Length);
        }
    }

其他一些看起来与此相似:

public override void Write(byte[] buffer, int offset, int count)
    {
        // vulnerability
        compressedStream.Write(buffer, offset, count);
    }

0 个答案:

没有答案