Refactor legacy C++ code for testing / working with private and protected methods

C++ has acquired capabilities related to inheritance throughout its rich history that are not available in high-level languages like C# or Java (although simplified design avoids issues like the diamond problem; however, the diamond problem can still occur with interfaces in Java. But our topic today is testing, not language design). These capabilities include multiple inheritance, public/protected/private inheritance… Read More »

Use C++ unit tests on MacOS

I’ve never written C/C++ code for macOS before, despite using macOS as my primary notebook for daily tasks. It was fascinating to explore how configuration options for header files and libraries work in this environment. As you may recall, in Visual Studio on Windows, you can use various tools to build projects, including the very powerful vcpkg. On… Read More »

Apache Tomcat and http header max size

I recently encountered an interesting issue that I thought might be worth sharing, as it relates to the common practice of limiting incoming requests based on certain parameters like restricting the size of headers. This kind of restriction is typically implemented by web servers (e.g., Apache, Nginx, etc.) to prevent various attacks, such as buffer overflows or denial… Read More »

C++ vcppkg: A First Look

When you create your application using C/C++, there are several options for working with external dependencies, such as libraries like: and so on. Some of the libraries, along with header files, are available for installation using a Linux package manager thus we typically do the following: In Linux package managers, development-related libraries often have -dev or -devel as… Read More »

How to track processes running with administrative rights in Windows

To gather information about processes running with administrator privileges on endpoints, it’s important to understand Windows Integrity Levels, introduced by Microsoft in Windows Vista (see Mandatory Integrity Control). Mandatory Integrity Control (MIC) is a security feature that enforces access control by assigning integrity levels to processes and objects. It uses integrity levels: Low, Medium, High, and System to… Read More »

Dynamic-size arrays with ANYSIZE_ARRAY in Windows API

You can often find structure in the code that looks like this TOKEN_PRIVILEGES structure. The ANYSIZE_ARRAY macro is used in the definition of the TOKEN_PRIVILEGES structure to allow for a flexible array member. This is a common technique in C and C++ to define structures that can have a variable-length array as their last member. In C and… Read More »

org.xerial.snappy.SnappyError: [FAILED_TO_LOAD_NATIVE_LIBRARY]

I got the error message below in my java producer on Mac laptop It happened on my laptop and I didn’t have time to investigate this so I just replaced ‘snappy’ compression-type value with ‘none’ in kafka producer configuration A small reminder: compression is used on producer and consumer side to decrease size of trasfered data through additional… Read More »