Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(15)

Delta Between Two Patch Sets: PC/winreg.c

Issue 25778: winreg.EnumValue does not truncate strings correctly
Left Patch Set: Created 4 years, 4 months ago
Right Patch Set: Created 4 years, 3 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « Lib/test/test_winreg.py ('k') | no next file » | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 /* 1 /*
2 winreg.c 2 winreg.c
3 3
4 Windows Registry access module for Python. 4 Windows Registry access module for Python.
5 5
6 * Simple registry access written by Mark Hammond in win32api 6 * Simple registry access written by Mark Hammond in win32api
7 module circa 1995. 7 module circa 1995.
8 * Bill Tutt expanded the support significantly not long after. 8 * Bill Tutt expanded the support significantly not long after.
9 * Numerous other people have submitted patches since then. 9 * Numerous other people have submitted patches since then.
10 * Ripped from win32api module 03-Feb-2000 by Mark Hammond, and 10 * Ripped from win32api module 03-Feb-2000 by Mark Hammond, and
(...skipping 677 matching lines...) Expand 10 before | Expand all | Expand 10 after
688 switch (typ) { 688 switch (typ) {
689 case REG_DWORD: 689 case REG_DWORD:
690 if (retDataSize == 0) 690 if (retDataSize == 0)
691 obData = PyLong_FromUnsignedLong(0); 691 obData = PyLong_FromUnsignedLong(0);
692 else 692 else
693 obData = PyLong_FromUnsignedLong(*(int *)retDataBuf); 693 obData = PyLong_FromUnsignedLong(*(int *)retDataBuf);
694 break; 694 break;
695 case REG_SZ: 695 case REG_SZ:
696 case REG_EXPAND_SZ: 696 case REG_EXPAND_SZ:
697 { 697 {
698 /* the buffer may or may not have a trailing NULL */ 698 /* REG_SZ should be a NUL terminated string, but only by
Zach Ware 2015/12/03 04:51:54 I think this comment could use an update.
699 * convention. The buffer may have been saved without a NUL
700 * or with embedded NULs. To be consistent with reg.exe and
701 * regedit.exe, consume only up to the first NUL. */
699 wchar_t *data = (wchar_t *)retDataBuf; 702 wchar_t *data = (wchar_t *)retDataBuf;
700 size_t len = wcsnlen(data, retDataSize / sizeof(wchar_t)); 703 size_t len = wcsnlen(data, retDataSize / sizeof(wchar_t));
701 obData = PyUnicode_FromWideChar(data, len); 704 obData = PyUnicode_FromWideChar(data, len);
702 break; 705 break;
703 } 706 }
704 case REG_MULTI_SZ: 707 case REG_MULTI_SZ:
705 if (retDataSize == 0) 708 if (retDataSize == 0)
706 obData = PyList_New(0); 709 obData = PyList_New(0);
707 else 710 else
708 { 711 {
(...skipping 1207 matching lines...) Expand 10 before | Expand all | Expand 10 after
1916 ADD_INT(REG_DWORD_BIG_ENDIAN); 1919 ADD_INT(REG_DWORD_BIG_ENDIAN);
1917 ADD_INT(REG_LINK); 1920 ADD_INT(REG_LINK);
1918 ADD_INT(REG_MULTI_SZ); 1921 ADD_INT(REG_MULTI_SZ);
1919 ADD_INT(REG_RESOURCE_LIST); 1922 ADD_INT(REG_RESOURCE_LIST);
1920 ADD_INT(REG_FULL_RESOURCE_DESCRIPTOR); 1923 ADD_INT(REG_FULL_RESOURCE_DESCRIPTOR);
1921 ADD_INT(REG_RESOURCE_REQUIREMENTS_LIST); 1924 ADD_INT(REG_RESOURCE_REQUIREMENTS_LIST);
1922 return m; 1925 return m;
1923 } 1926 }
1924 1927
1925 1928
LEFTRIGHT

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+