1. Список говнокодов пользователя 3_dar

    Всего: 122

  2. Go / Говнокод #28254

    +1

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    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

    3_dar, 29 Июня 2022

    Комментарии (47)
  3. Куча / Говнокод #28200

    −1

    1. 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

    3_dar, 30 Мая 2022

    Комментарии (171)
  4. C++ / Говнокод #28198

    −1

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    #include <stdio.h>
    
    int main() {
        char* pituh;
        puts(pituh);
        pituh = "kokoko";
        return 0;
    }

    Угадайте что выведет код?
    ISO и прочим скилловикам просьба воздержаться.

    https://ideone.com/sYrqiB

    3_dar, 29 Мая 2022

    Комментарии (77)
  5. Go / Говнокод #28193

    −2

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    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.

    3_dar, 26 Мая 2022

    Комментарии (93)
  6. C++ / Говнокод #28192

    0

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    #include <iostream>
    
    int main() {
        const char* pituh = {};
        std::cout << pituh;
    }

    Нахуя?

    3_dar, 26 Мая 2022

    Комментарии (7)
  7. Куча / Говнокод #28190

    0

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    33. 33
    34. 34
    35. 35
    36. 36
    37. 37
    38. 38
    39. 39
    40. 40
    41. 41
    42. 42
    43. 43
    44. 44
    45. 45
    46. 46
    47. 47
    48. 48
    49. 49
    50. 50
    51. 51
    52. 52
    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;

    3_dar, 25 Мая 2022

    Комментарии (13)
  8. Go / Говнокод #28110

    +1

    1. 1
    2. 2
    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

    3_dar, 05 Апреля 2022

    Комментарии (29)
  9. Java / Говнокод #28107

    +1

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    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

    3_dar, 04 Апреля 2022

    Комментарии (4)
  10. Си / Говнокод #28096

    0

    1. 1
    #exclude <conio.h>

    конио

    3_dar, 29 Марта 2022

    Комментарии (13)
  11. Си / Говнокод #28088

    0

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    33. 33
    34. 34
    35. 35
    36. 36
    37. 37
    38. 38
    39. 39
    40. 40
    41. 41
    42. 42
    43. 43
    44. 44
    45. 45
    46. 46
    47. 47
    48. 48
    49. 49
    50. 50
    51. 51
    52. 52
    53. 53
    54. 54
    55. 55
    56. 56
    57. 57
    58. 58
    59. 59
    60. 60
    61. 61
    62. 62
    63. 63
    /*
     *  libcaca       Colour ASCII-Art library
     *  Copyright (c) 2002-2010 Sam Hocevar <[email protected]>
     *                All Rights Reserved
     *
     *  This library is free software. It comes without any warranty, to
     *  the extent permitted by applicable law. You can redistribute it
     *  and/or modify it under the terms of the Do What The Fuck You Want
     *  To Public License, Version 2, as published by Sam Hocevar. See
     *  http://sam.zoy.org/wtfpl/COPYING for more details.
     */
    
    /*
     *  This header contains a conio.h reimplementation.
     */
    
    #ifndef __CACA_CONIO_H__
    #define __CACA_CONIO_H__
    
    /* Since we're going to redefine standard functions, include these
     * headers first to avoid errors upon later inclusion. */
    #if !defined(__KERNEL__)
    #   include <stdio.h>
    #endif
    
    #include <caca.h>
    
    #if !defined _DOXYGEN_SKIP_ME && !defined __LIBCACA__
    #   undef BLINK
    #   define BLINK CACA_CONIO_BLINK
    #   undef BLACK
    #   define BLACK CACA_CONIO_BLACK
    #   undef BLUE
    #   define BLUE CACA_CONIO_BLUE
    #   undef GREEN
    #   define GREEN CACA_CONIO_GREEN
    #   undef CYAN
    #   define CYAN CACA_CONIO_CYAN
    #   undef RED
    #   define RED CACA_CONIO_RED
    #   undef MAGENTA
    #   define MAGENTA CACA_CONIO_MAGENTA
    #   undef BROWN
    #   define BROWN CACA_CONIO_BROWN
    #   undef LIGHTGRAY
    #   define LIGHTGRAY CACA_CONIO_LIGHTGRAY
    #   undef DARKGRAY
    #   define DARKGRAY CACA_CONIO_DARKGRAY
    #   undef LIGHTBLUE
    #   define LIGHTBLUE CACA_CONIO_LIGHTBLUE
    #   undef LIGHTGREEN
    #   define LIGHTGREEN CACA_CONIO_LIGHTGREEN
    #   undef LIGHTCYAN
    #   define LIGHTCYAN CACA_CONIO_LIGHTCYAN
    #   undef LIGHTRED
    #   define LIGHTRED CACA_CONIO_LIGHTRED
    #   undef LIGHTMAGENTA
    #   define LIGHTMAGENTA CACA_CONIO_LIGHTMAGENTA
    #   undef YELLOW
    #   define YELLOW CACA_CONIO_YELLOW
    #   undef WHITE
    #   define WHITE CACA_CONIO_WHITE
    #endif

    3_dar, 22 Марта 2022

    Комментарии (3)