- 1
- 2
- 3
} catch (...) {
// ¯\_(ツ)_/¯
}
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
Всего: 113
+2
} catch (...) {
// ¯\_(ツ)_/¯
}
Ну заебись комментарий
+1
package main
import "log"
func foo(x int) (int, error) {
return x + 1, nil
}
func main() {
x := 5
if x % 2 == 1 {
x, err := foo(x)
if err != nil {
log.Fatalf("Error")
}
log.Println(x)
}
log.Println(x)
}
Счастливой отладки, суки.
https://godbolt.org/z/6GWsq7W7q
−1
Минск #5
#1: https://govnokod.ru/25937 https://govnokod.xyz/_25937
#2: https://govnokod.ru/26458 https://govnokod.xyz/_26458
#3: https://govnokod.ru/27233 https://govnokod.xyz/_27233
#4: https://govnokod.ru/27448 https://govnokod.xyz/_27448
−1
#include <stdio.h>
int main() {
char* pituh;
puts(pituh);
pituh = "kokoko";
return 0;
}
Угадайте что выведет код?
ISO и прочим скилловикам просьба воздержаться.
https://ideone.com/sYrqiB
−2
package main
func main() {
var str = "Hello World"
var length = len([]rune(str))
println("Length of the string is :", length)
}
String Length in Golang
To get the length of a String in Go programming, convert the string to array of runes, and pass this array to len() function.
0
#include <iostream>
int main() {
const char* pituh = {};
std::cout << pituh;
}
Нахуя?
0
with Ada.Unchecked_Conversion;
with Interfaces.C;
with System.Address_To_Access_Conversions;
with System.Address_Operations; use System.Address_Operations;
with VGA_Console; use VGA_Console;
procedure Crash (Source_Location : System.Address; Line : Integer) is
package C renames Interfaces.C;
-- Get the length of the C NULL terminated string.
function Length (Source_Location : System.Address) return C.size_t is
use type C.size_t;
function Convert is new Ada.Unchecked_Conversion (Source => C.size_t,
Target => System.Address);
package To_Char is new System.Address_To_Access_Conversions (Object => C.char);
Count : C.size_t := 0;
Char : To_Char.Object_Pointer := To_Char.To_Pointer (AddA (Source_Location, Convert (Count)));
begin
while C.char'Pos (Char.all) /= 0 loop
Count := Count + 1;
Char := To_Char.To_Pointer (AddA (Source_Location, Convert (Count)));
end loop;
return Count;
end Length;
-- This is really ugly, just to convert an address pointing to a C NULL terminated string to an Ada String!
Source_Length : constant C.size_t := Length (Source_Location);
type Source_Chars is new C.char_array (0 .. Source_Length);
C_Str : Source_Chars with
Address => Source_Location;
pragma Import (Convention => Ada, Entity => C_Str);
Source_Str : constant String := C.To_Ada (C.char_array (C_Str));
begin
Put (Str => "** Kernel crashed at: " & Source_Str & ":" & Integer'Image (Line) & " **",
X => 1,
Y => 10,
Foreground => White,
Background => Red);
-- TODO: Dump registers.
Hang : loop
null;
end loop Hang;
end Crash;
+1
math.Min(float64, float64) float64
math.Max(float64, float64) float64
В goвне нету math.Min для integer. Даже в анскильном "Си" это есть.
https://www.pixelstech.net/article/1559993656-Why-no-max-min-function-for-integer-in-GoLang
0
import org.springframework.core.Ordered;
import org.springframework.core.annotation.Order;
import org.springframework.web.bind.WebDataBinder;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.InitBinder;
@ControllerAdvice
@Order(10000)
public class BinderControllerAdvice {
@InitBinder
public void setAllowedFields(WebDataBinder dataBinder) {
String[] denylist = new String[]{"class.", "Class.", ".class.", ".Class."};
dataBinder.setDisallowedFields(denylist);
}
}
Критическая 0-day уязвимость в Spring Framework, применяемом во многих Java-проектах
Работа эксплоита сводится к отправке запроса с параметрами "class.module.classLoader.resources.cont ext.parent.pipeline.first.*", обработка которых при использовании "WebappClassLoaderBase" приводит к обращению к классу AccessLogValve. Указанный класс позволяет настроить логгер для создания произвольного jsp-файла в корневом окружении Apache Tomcat и записи в этот файл указанного атакующим кода. Созданный файл становится доступным для прямых запросов и может использоваться в качестве web shell. Для атаки на уязвимое приложение в окружении Apache Tomcat достаточно отправить запрос с определёнными параметрами при помощи утилиты curl.
curl -v -d "class.module.classLoader.resources.context.parent.pipeline
.first.pattern=код_для_вставки_в_файл
&class.module.classLoader.resources.context.parent.pipeline.first.suffix=.jsp
&class.module.classLoader.resources.context.parent.pipeline.first.directory=webapps/ROOT
&class.module.classLoader.resources.context.parent.pipeline.first.prefix=tomcatwar
&class.module.classLoader.resources.context.parent.pipeline.first.fileDateFormat="
http://localhost:8080/springmvc5-helloworld-exmaple-0.0.1-SNAPSHOT/rapid7
0
#exclude <conio.h>
конио