Skip to content

Gracefully handle references with null bytes

Stan Hu requested to merge sh-handle-string-null-bytes into master

Rugged::Reference.valid_name? used in Gitlab::GitRefValidator.validate fails on strings containing null bytes because it uses StringValueCStr(). Per https://silverhammermba.github.io/emberb/c/:

Ruby’s String kinda corresponds to C’s char*. The simplest macro is StringValueCStr() which returns a null-terminated char* for a String. The problem here is that a Ruby String might contain nulls - in which case StringValueCStr() will raise an ArgumentError!

Closes #54466 (closed)

Merge request reports