Exploit databaseDownload repository ZIP
GH-85c4967f57de7e323dea5f5692208706
xyddnljydd/cve-2020-17136
Sources for CVE-2020-17136
3 sourcesPreferred order: Exploit-DB, Metasploit, then GitHub repositories by stars. Open preferred source
Repository files23
xyddnljydd/cve-2020-17136Revision bff3c80fc632
- ↑..Parent directory
- Debug/
- CommonUtils.cpp
- CommonUtils.h
- CommonUtils.vcxproj
- CommonUtils.vcxproj.filters
- CommonUtils.vcxproj.user
- DirectoryObject.cpp
- FileOpLock.cpp
- FileOpLock.h
- FileSymlink.cpp
- FileSymlink.h
- Hardlink.cpp
- NativeSymlink.cpp
- RegistrySymlink.cpp
- ReparsePoint.cpp
- ReparsePoint.h
- ScopedHandle.cpp
- ScopedHandle.h
- ntimports.h
- stdafx.cpp
- stdafx.h
- targetver.h
- typed_buffer.h
Files from this repository share one source choice. Supporting files may cover other vulnerabilities.
CommonUtils/typed_buffer.h
Text · 1,316 bytes#pragma once
#include <memory>
#include <algorithm>
template<class T>
class typed_buffer_ptr {
std::unique_ptr<char[]> buffer_;
size_t size_;
public:
typed_buffer_ptr() {
}
explicit typed_buffer_ptr(size_t size) {
reset(size);
}
void reset(size_t size) {
buffer_.reset(new char[size]);
memset(buffer_.get(), 0, size);
size_ = size;
}
void resize(size_t size) {
std::unique_ptr<char[]> tmp(new char[size]);
memcpy(tmp.get(), buffer_.get(), min(size, size_));
buffer_ = std::move(tmp);
size_ = size;
}
operator T*() {
return reinterpret_cast<T*>(buffer_.get());
}
operator const T*() const {
return cget();
}
T* operator->() const {
return reinterpret_cast<T*>(buffer_.get());
}
const T* cget() const {
return reinterpret_cast<const T*>(buffer_.get());
}
typed_buffer_ptr(const typed_buffer_ptr<T>& other) = delete;
typed_buffer_ptr& typed_buffer_ptr::operator=(const typed_buffer_ptr<T>& other) = delete;
typed_buffer_ptr(typed_buffer_ptr<T>&& other) {
buffer_ = std::move(other.buffer_);
size_ = other.size_;
other.size_ = 0;
}
typed_buffer_ptr& operator=(typed_buffer_ptr<T>&& other) {
if (this != &other)
{
buffer_ = std::move(other.buffer_);
size_ = other.size_;
other.size_ = 0;
}
}
size_t size() const {
return size_;
}
};