Changeset 2869 for trunk/kLdr/kLdrHlp.c
- Timestamp:
- Nov 12, 2006, 3:47:25 AM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kLdr/kLdrHlp.c
r2867 r2869 386 386 * 387 387 * @returns 0 on success. 388 * @returns KLDR_ERR_BUFFER_OVERFLOW on if the buffer is too small (it'll be partially filled).388 * @returns KLDR_ERR_BUFFER_OVERFLOW on if the buffer is too small. 389 389 * @returns KLDR_ERR_SYMBOL_NOT_FOUND if not found. (Yeah, abusing the status code, but it's only internally...) 390 390 * @returns OS specfic status code on other error. … … 407 407 kLdrHlpMemCopy(pszVal, pszValue, cch + 1); 408 408 else 409 {410 409 rc = KLDR_ERR_BUFFER_OVERFLOW; 411 if (cchVal > 1)412 {413 kLdrHlpMemCopy(pszVal, pszValue, *pcchVal);414 pszVal[*pcchVal - 1] = '\0';415 }416 }417 410 } 418 411 else … … 425 418 SetLastError(0); 426 419 cch = GetEnvironmentVariable(pszVar, pszVal, cchVal); 427 if (cch < cchVal)420 if (cch > 0 && cch < cchVal) 428 421 return 0; 429 422 … … 796 789 const uint8_t *pb = (const uint8_t *)pv; 797 790 const uint8_t b = (uint8_t)ch; 798 while (cb )791 while (cb-- > 0) 799 792 { 800 793 if (*pb == b) … … 811 804 const uint8_t *pb1 = (const uint8_t *)pv1; 812 805 const uint8_t *pb2 = (const uint8_t *)pv2; 813 while (cb )806 while (cb-- > 0) 814 807 { 815 808 if (*pb1 != *pb2)
Note:
See TracChangeset
for help on using the changeset viewer.