On 12/02/2013 12:53 AM, Magnus Fromreide wrote: > On Fri, 2013-11-29 at 11:24 +0800, yzhu1 wrote: >> On 11/26/2013 02:58 PM, Magnus Fromreide wrote: >>> On Tue, 2013-11-26 at 11:05 +0800, yzhu1 wrote: >>>> Hi, Magnus >>>> >>>> Follow your advice, I made the 3 new patches. Now the patches are in the >>>> attachment. Please check them. >>>> Thanks a lot. >>> Are that really the new patches? >>> It seems all the issues I spoke about are still present. >>> >>> /MF >>> >>> >> Hi, Magnus >> >> To now, there are 7 patches in total. >> >> 0001-snmpTargetParams-supports-zero-OID.patch <----support zero OID >> in snmpTargetParams >> 0002-fix-param-length.patch <----fix a defect which result from params >> length >> 0003-conf-support.patch <----support save/restore zero OID in conf file >> 0004-use-params-hex-string-as-index.patch <----use params >> hex string as index in tlstmparams >> 0005-use-nameData-hex-string-as-index.patch <----use namedata >> hex string as index in tlstmaddr >> 0006-replace-nameData-with-nameDate-hex-string-in-log.patch <----use hex >> string of namedata in log >> 0007-Use-paramsLen-to-replace-params.patch <----fix a bug since >> params == NULL can not exactly suggest that params has no value >> >> After these 7 patches are applied, net-snmp can work well to now. >> Please comment these patches and merge them. > Thanks for the patch collection - that made it easier to review them. > > #6 and #5: > * An SnmpAdminString is no more than 255 octets, so the tmp buffer > is unnecessarily big, maxlen * 2 + 2 (0x) + 1 (\0) = 513 bytes > is enough. > * I still fail to understand why you prefer to write 1024 NUL's to > the tmp buffer before reading the value instead of writing a > single NUL to it after having read the value, and in the case of > read_config_save_octet_value the output is a NUL-terminated > string in any case so there is no reason for it at all there. > #4: > * A variant of #6 and #5. The buffer to > read_config_save_octet_string is not big enough at only 512 > bytes. > * Tricky and Important: Earlier the value FOO matched a string > with value FOO but with your patch it matches the string "FOO". > This changes the interface of the agent. Hi, Magnus
Do you mean this " + /**To get len and param**/ *line = read_config_read_octet_string(*line, (u_char **)&tmp, &len); tmp[len] = 0; /** xxx-rks: validate snmpadminstring? */ - if (len) - stp->name = strdup(buf); + if (len){ + char temp[SNMP_MAXBUF_SMALL]; + read_config_save_octet_string(temp, buf, len); + stp->name = strdup(temp);/**use param hex value as index**/ + } " will change name from ascii string to hex string ? Yes. I confirmed this. But I checked the source code. Maybe there is no place except this to use this string. So it will not introduce any risk. Thanks a lot. Zhu Yanjun > > Thanks for doing this work. > > /MF > > ------------------------------------------------------------------------------ Sponsored by Intel(R) XDK Develop, test and display web and hybrid apps with a single code base. Download it for free now! http://pubads.g.doubleclick.net/gampad/clk?id=111408631&iu=/4140/ostg.clktrk _______________________________________________ Net-snmp-coders mailing list Net-snmp-coders@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/net-snmp-coders