Code Monkey home page Code Monkey logo

Comments (2)

0neblock avatar 0neblock commented on July 16, 2024

Hi @ae-zero, Interesting find with this bug.
As you can see from the OID Encoding method here:

bool OIDType::generateInternalData() {
if(_value.find(".1.3.") != 0) { this->valid = false; return false; }; // Invalid OID
this->data.clear();
this->data.push_back(0x2b); // first byte
char* valuePtr = &_value[5];
while(*valuePtr != 0){
bool toBreak = false;
char* startNum = valuePtr;
// Find the end of this item (next dot or end of string)
char* endNum = strchr(startNum, '.');
if(!endNum) {
toBreak = true;
}
long tempVal;
uint8_t temp[10] = {0};
if(sscanf(startNum, "%ld.", &tempVal)){
int encoded_length = encode_ber_longform_integer(temp, tempVal, 10);
for(int i = 0; i < encoded_length; i++){
this->data.push_back(temp[i]);
}
if(toBreak) break;
valuePtr = endNum+1;
} else {
return false;
}
}
this->_length = this->data.size();
return true;
}

I assume that all OID's are prefixed with .1.3

I can't remember why I did this originally, but obviously most OID's fit this format.

This can be fixed by changing the encoding to https://docs.microsoft.com/en-us/windows/win32/seccertenroll/about-object-identifier?redirectedfrom=MSDN, which I will add to my list but may not be able to do for a while.

The decoding will also have to be fixed in BERDecode.cpp

from arduino_snmp.

ae-zero avatar ae-zero commented on July 16, 2024

Thanks for looking into it, @0neblock! I went in and starting meddling with those two files, but ended up making it much worse :)

Thanks for putting it on your list!

from arduino_snmp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.