Skip to content

Instantly share code, notes, and snippets.

View lynxplay's full-sized avatar
🔎
Investigating those UBs

Bjarne Koll lynxplay

🔎
Investigating those UBs
View GitHub Profile
@lynxplay
lynxplay / gradlew-or-gradle.sh
Last active January 26, 2023 14:17
gradle alias to verify wrapper hashes
alias gradle="_gradlew-or-gradle"
function _gradlew-or-gradle() {
CURRENT_DIR="$PWD"
until [ -f "./gradlew" ] || [ "$PWD" = "$TEMP_PWD" ]; do TEMP_PWD=$PWD; cd ..; done
if [[ -f "./gradlew" ]]; then
if [[ ! -f "./gradle/wrapper/gradle-wrapper.jar" ]]; then
echo "Could not find project wrapper jar for checksum validation!"
echo "Please run ./gradlew manually if you are sure of it!"
@lynxplay
lynxplay / UnixSystemNamelessError.java
Last active October 2, 2021 21:22
An example case for the UnixSystem.java failure to retrieve uid, gid and groups if the user has no username
public class UnixSystemNameless {
public static void main(String[] args) {
final var unixSystem = new com.sun.security.auth.module.UnixSystem();
System.out.printf("username: %s%n", unixSystem.getUsername());
System.out.printf("uid: %d%n", unixSystem.getUid());
System.out.printf("gid: %d%n", unixSystem.getGid());
System.out.printf("groups: %s%n", java.util.Arrays.toString(unixSystem.getGroups()));
}