fuzzERP.c 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. /*
  2. Fuzzes erp Information element
  3. */
  4. #include <stdio.h>
  5. #include <stdlib.h>
  6. #include <stdint.h>
  7. #include <string.h>
  8. #include "../frameDefinitions.h"
  9. //Indecates whether the erpFuzzer is running
  10. int erpRunningState = 0;
  11. //Number of fuzzing states
  12. const int erpStates = 1;
  13. //Steps of fuzzers for each fuzzing state
  14. const int erpSteps[] = {10};
  15. //Current state and step of the erpFuzzer
  16. int fuzzState;
  17. int fuzzStep;
  18. void erpPrintCurrentState()
  19. {
  20. }
  21. //Updates erpFuzzer
  22. //Status 0 indicates start
  23. //Status 1 indicates increaseStep
  24. //Status 2 indicates stop
  25. //Returns -1 if done with fuzzing
  26. int erpFuzzUpdate(int status)
  27. {
  28. fuzzState = 0;
  29. if (fuzzStep == 0)
  30. fuzzStep = 1;
  31. else
  32. fuzzStep = 0;
  33. return 0;
  34. }
  35. //Returns an erp information element
  36. infoElem erpFuzz()
  37. {
  38. infoElem erp;
  39. //What to return when not fuzzed
  40. if (fuzzStep == 0)
  41. {
  42. int dataSize = 10;
  43. erp.id = 42;
  44. erp.len = dataSize;
  45. erp.len_data = dataSize;
  46. //create data of datasize times 0xff
  47. u_char *data = malloc(dataSize);
  48. memset(data, 0xff, dataSize);
  49. erp.data = data;
  50. }
  51. else
  52. {
  53. int dataSize = 253;
  54. erp.id = 42;
  55. erp.len = dataSize;
  56. erp.len_data = dataSize;
  57. //create data of datasize times 0xff
  58. u_char *data = malloc(dataSize);
  59. memset(data, 0xff, dataSize);
  60. erp.data = data;
  61. }
  62. return erp;
  63. }