{"id":15213,"date":"2010-01-20T07:00:00","date_gmt":"2010-01-20T07:00:00","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/oldnewthing\/2010\/01\/20\/the-wrong-way-to-determine-the-size-of-a-buffer\/"},"modified":"2010-01-20T07:00:00","modified_gmt":"2010-01-20T07:00:00","slug":"the-wrong-way-to-determine-the-size-of-a-buffer","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/oldnewthing\/20100120-00\/?p=15213","title":{"rendered":"The wrong way to determine the size of a buffer"},"content":{"rendered":"<p>\nA colleague of mine showed me some code from a back-end\nprogram on a web server.\nFortunately, the company that wrote this is out of business.\nOr at least I hope they&#8217;re out of business!\n<\/p>\n<pre>\nsize = 16384;\nwhile (size &amp;&amp; IsBadReadPtr(buffer, size)) {\n    size--;\n}\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>A colleague of mine showed me some code from a back-end program on a web server. Fortunately, the company that wrote this is out of business. Or at least I hope they&#8217;re out of business! size = 16384; while (size &amp;&amp; IsBadReadPtr(buffer, size)) { size&#8211;; }<\/p>\n","protected":false},"author":1069,"featured_media":111744,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[25],"class_list":["post-15213","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-oldnewthing","tag-code"],"acf":[],"blog_post_summary":"<p>A colleague of mine showed me some code from a back-end program on a web server. Fortunately, the company that wrote this is out of business. Or at least I hope they&#8217;re out of business! size = 16384; while (size &amp;&amp; IsBadReadPtr(buffer, size)) { size&#8211;; }<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/15213","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/users\/1069"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/comments?post=15213"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/15213\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/media\/111744"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/media?parent=15213"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/categories?post=15213"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/tags?post=15213"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}