Github user DaveBirdsall commented on a diff in the pull request:
https://github.com/apache/trafodion/pull/1394#discussion_r162226893
--- Diff: core/conn/odb/src/odb.c ---
@@ -5313,7 +5313,7 @@ static void etabadd(char type, char *run, int id)
}
}
if ( etab[no].type == 'e' ) { /* name & create output file
*/
- for ( i = j = 0; etab[no].tgt[i] && i < sizeof(buff);
i++ ) {
+ for ( i = j = 0; i < sizeof(buff) && etab[no].tgt[i];
i++ ) {
--- End diff --
I tried to make sense of this too. It looks like etab[no].tgt is populated
in function parseopt from some string buffer; I can't tell if it is buff (which
is a static variable declared as a char[256]) or something else. My suspicion
is that the test "i < sizeof(buff)" has nothing to do with etab[no].tgt but
rather some other buffer being copied to. In any case, reversing the order of
these tests seems harmless.
---