-
Notifications
You must be signed in to change notification settings - Fork 15
Description
Dear friends,
Your paper on Graspan leaves us a deep impression. It is definitely a good work that opens up a new direction.
Here, we found two security issues in your code and, perhaps, it can help improve.
The first one is at https://github.com/Graspan/graspan-cpp/blob/master/src/preproc/preproc.cpp#L60
The code is like:
while (fscanf(fp, "%d\t%d\t%s\n", &src, &dst, ctemp) != EOF) {
label += ctemp;
data[src].push_back(std::make_pair(dst, label)); // <-- "src" is from an external file that may cause a buffer-overflow vulnerability. It is better to put a sanity check on "src" here.
dataCheck[dst] = 1;
dataCheck[src] = 1;
count++;
label = "";
}
The second is similar and is here: https://github.com/Graspan/graspan-cpp/blob/master/src/preproc/preproc_new.cpp#L56
while (fscanf(fp, "%d\t%d\t%s\n", &src, &dst, ctemp) != EOF) {
dataCount[src]++; // <-- "src" is from an external file, It is better to put a sanity check on "src" here.
count++;
}