Debian Codegraph @

debian/patches/05_control_empty_values

raw
1 --- a/ntreg.c
2 +++ b/ntreg.c
3 @@ -2667,21 +2667,23 @@
4 value = (char *)get_val_data(hdesc, nkofs, vex.name, vex.type, TPF_VK_EXACT);
5 len = get_val_len(hdesc, nkofs, vex.name, TPF_VK_EXACT);
6
7 - if (vex.type == REG_BINARY) {
8 - fprintf(file, "\"%s\"=hex:", vex.name);
9 - } else {
10 - fprintf(file, "\"%s\"=hex(%x):", vex.name, vex.type);
11 - }
12 - byte = 0;
13 - while (byte < len) { /* go byte by byte.. probably slow.. */
14 - fprintf(file, "%02x,", (unsigned char)value[byte]);
15 - byte++;
16 - if (!(byte % 20)) fprintf(file, "\\\r\n ");
17 - }
18 - fprintf(file, "%02x\r\n", (unsigned char)value[byte]);
19 - }
20 + if (value && len >= 0) {
21 + if (vex.type == REG_BINARY) {
22 + fprintf(file, "\"%s\"=hex:", vex.name);
23 + } else {
24 + fprintf(file, "\"%s\"=hex(%x):", vex.name, vex.type);
25 + }
26 + byte = 0;
27 + while (byte < len) { /* go byte by byte.. probably slow.. */
28 + fprintf(file, "%02x,", (unsigned char)value[byte]);
29 + byte++;
30 + if (!(byte % 20)) fprintf(file, "\\\r\n ");
31 + }
32 + fprintf(file, "%02x\r\n", (unsigned char)value[byte]);
33
34 - FREE(vex.name);
35 + FREE(vex.name);
36 + }
37 + }
38 }
39 }
40